Hi there,

 

why are those not equivalent? I.e., the foreach (which is more concise) does not work as (I) expected. Is there a tweak to make it work?

 

<hansl>

open denmark.gdt -q

list ls = 1 4

    matrices M = null

    loop foreach l ls

        matrix temp = l

        colnames(temp,varname(l))

        M+=temp

    endloop

   

    matrices M2 = null

    loop for s=1..nelem(ls)

        matrix temp = ls[s]

        colnames(temp,varname(ls[s]))

        M2 += temp

    endloop

 

    ?M

    ?M2

</hansl>

 

Thanks

Frederik