For maximum efficiency Diego's loop solution is likely best but for 
succinctness, try hcat(A...).

Den lördagen den 23:e augusti 2014 kl. 04:05:19 UTC+2 skrev Bradley Setzler:
>
> Good evening,
>
> I often have Any types filled with vectors (especially as the return of a 
> pmap), and need them as a matrix or DataFrame. For example, suppose I have,
>
> julia> A
> 3-element Array{Any,1}: 
> [1,2] 
> [3,4] 
> [5,6]
>
> But I want,
>
> julia> B
> 2x3 Array{Int64,2}: 
> 1 3 5 
> 2 4 6
>
> I came up with the following, which successfully constructs B from A, but 
> it's a bit inefficient/messy:
>
> B = A[1]
> for i=2:length(A)
>     B = hcat(B,A[i])
> end
>
> Is there a better way to do this? Something like,
> julia> B = hcatForAny(A)
>
> Thanks,
> Bradley
>
>

Reply via email to