help-octave
[Top][All Lists]

## Re: Looping deeper in structure elements

 From: Etienne Grossmann Subject: Re: Looping deeper in structure elements Date: Thu, 23 Nov 2006 00:25:23 -0500 User-agent: Mutt/1.4.2.1i

```  Hi Falk,

something like this?
Code:=================================================================
zeug.cm0.x=4;
for [v,k] = zeug
for [v2,k2] = v
zeug.(k).(k2) *= 10;
end;
end;
zeug
Result:===============================================================
zeug =
{
cm0 =
{
x =  40
}
}
======================================================================

Note the zeug.(k) construct and the *= operator.

Hth,

Etienne

On Wed, Nov 22, 2006 at 09:03:09AM +0100, Falk Dechent wrote:
# Hi everybody!
# I'm new using octave (and never used mathlab) and I have several questions.
# Will slpit them in two posts.
#
# zeug.cm0=1;
#
# for [val,key] = zeug
#         key=10 * val;
# endfor
# zeug.cm0 #result =1
#
#
# for [val,key] = zeug
#         val=10 * val;
# endfor
# zeug.cm0 #result =1
#
#
# for [val,key] = zeug
#         eval(strcat('zeug.' , key , '=10 *val;' ));
# endfor
# zeug.cm0 #result =10
#
# Well is there an other method do this my goal is something like this:
# zeug.cm0.x=4;
#
# for [val,key] = zeug
#       for [val,key] = val
#              val=10 * val;
#       endfor
# endfor
# zeug.cm0.x=40;
#
# Ideas I hope someone can help
# Falk
#
# (octave 2.9.9)

# _______________________________________________
# Help-octave mailing list