Try

for fl in fieldnames(myt)
   push!(getfield(myt,fl), 0.)
end

`fieldnames` returns the name of the field as a symbol, thus your error.

On Mon, 2016-10-10 at 16:41, K leo <cnbiz...@gmail.com> wrote:
> I hope to expand all arrays in a type using something like the following:
>
> fields=fieldnames(myType)
>> for i=1:length(fields)
>>     push!(fields[i], 0.)
>> end
>
>
> But I get error saying no method matching push!(::Symbol, ::Float64)
>
> What else can I do for my purpose?

Reply via email to