[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looping over two equal length cell arrays?
From: |
fork |
Subject: |
Re: Looping over two equal length cell arrays? |
Date: |
Fri, 30 Apr 2010 23:44:36 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Søren Hauberg <soren <at> hauberg.org> writes:
>
> fre, 30 04 2010 kl. 22:54 +0000, skrev fork:
> > This is what I want to do:
> >
> > s = struct()
> > keys = {'a', 'b', 'c'}
> > vals = {1,2,3}
> > for k = keys, v = vals
> > s = setfield(s, k, v);
> > endfor
> > s.a == 1
>
> I'm not sure if this syntax is nicer, but here it goes anyway:
Hehe, it is cooler in a funny sort of way... but I might stick with the old as
there is other stuff I want to do in the loop.
Tx!