> julia> reshape(d,3,2)
3x2 Array{ASCIIString,2}: "x1" "y2" "y1" "x3" "x2" "y3" This is because of Julia's column-major ordering. you see the problem ? instead I would like to have : x1 y1 x2 y2 .. xn yn In this case, you could use: julia> reshape(d,2,3)' 3x2 Array{ASCIIString,2}: "x1" "y1" "x2" "y2" "x3" "y3" On Wednesday, April 13, 2016 at 12:38:41 AM UTC+10, Fred wrote: > Thank you very much Tim ! > > In fact I want to create an X,Y array so if I create a 1D array, I can > only append to it (x1,y1) then (x2,y2)... (xn, yn), because I calculate x1 > before x2... > > julia> d = ["x1", "y1", "x2", "y2", "x3", "y3"] > 6-element Array{ASCIIString,1}: > "x1" > "y1" > "x2" > "y2" > "x3" > "y3" > > julia> reshape(d,3,2) > 3x2 Array{ASCIIString,2}: > "x1" "y2" > "y1" "x3" > "x2" "y3" > > you see the problem ? instead I would like to have : > x1 y1 > x2 y2 > .. > xn yn > > because I want to be able to work on columns and line ... of course > another easy solution is to use dataframes, but I tried with arrays because > the code should be faster... :) > > Le mardi 12 avril 2016 16:27:50 UTC+2, Tim Holy a écrit : >> >> Note that in `a = Array{Float64,2}`, `a` is a *type*, not an *instance*. >> You >> presumably mean `a = Array(Float64, 0, 0)`. >> >> But Yichao is right that you can't grow a 2d array, only a 1d one. >> >> Best, >> --Tim >> >