Sorry for being so noob once again, but I'm getting close without getting actually to it. Could somebody tell me please how should I change the previous definition of caw() as given by Jussi to make room for a Vector of Arrays (I can fix them to dimension 2) instead of a Vector of Vector? I'd like to be able to define it simllarly, so that instances of caw() are initially empty and I push!() 2-dimensional arrays into it...
Thanks and sorry again, Ferran. On Wednesday, July 20, 2016 at 6:37:25 PM UTC+2, Jussi Piitulainen wrote: > > keskiviikko 20. heinäkuuta 2016 18.57.13 UTC+3 Ferran Mazzanti kirjoitti: >> >> Sorry guys again, >> >> I said it works as I tried it out and seemed to work. Now I'm not even >> sure it does work, don't ask me why. I try now this >> >> type caw >> legs :: Int64 >> spots :: Vector{Vector{Float64}} >> caw() = new() >> end >> >> then I can do things like >> z = caw() >> which produce >> >> caw(4587026064,#undef) >> >> >> Now the question is: how do I start adding vectors to z.spots? >> >> I've tried things like >> >> >> push!(z.spots,[1.0]) >> >> >> but then I get >> >> >> LoadError: UndefRefError: access to undefined reference >> while loading In[30], in expression starting on line 1 >> >> >> Thanks for your help, >> >> >> Ferran. >> >> >> and now it does not complain >> >> On Monday, July 18, 2016 at 5:13:23 PM UTC+2, Ferran Mazzanti wrote: >>> >>> Guys, >>> >>> today I've tried to include a vector of vectors as part of atype >>> definition, something like >>> >>> type caw >>> legs :: Int64 >>> spots :: Array{Float64}[] >>> end >>> >>> but that fails. Shall I understand that it is not possible to define >>> that in a type definition? I just wanted to include a structrure that could >>> grow >>> by adding more data dynamically... >>> >>> Any hint about this? >>> >>> Thanks for your kind help, >>> >>> Ferran. >>> >> > > julia> type caw > legs :: Int64 > spots :: Vector{Vector{Float64}} > caw() = new(4587026064, Vector{Float64}[]) > end > > julia> z = caw() > caw(4587026064,Array{Float64,1}[]) > > julia> push!(z.spots, [1.0]) > 1-element Array{Array{Float64,1},1}: > [1.0] > > julia> z > caw(4587026064,[[1.0]]) > > > >