You're constructing caw with no spots at all, not an empty vector. You
should probably not construct incomplete objects, but rather create objects
with reasonable initial values, like new(0, Vector{Vector{Float64}}()). I'm
not sure what legs is supposed to be.

On Wed, Jul 20, 2016 at 11:57 AM, Ferran Mazzanti <ferran.mazza...@gmail.com
> wrote:

> 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.
>>
>

Reply via email to