help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Loop over cell arrays.


From: Sean Smith
Subject: RE: Loop over cell arrays.
Date: Thu, 26 Aug 2004 14:30:39 -0700

length(data)
ans = -1

that's my problem.

size(data)
ans =

  -1  -1

nothing seems to access the dimensions of this thing.

-----Original Message-----
From: Hall, Benjamin [mailto:address@hidden
Sent: Thursday, August 26, 2004 2:00 PM
To: 'Sean Smith'; 'address@hidden'
Subject: RE: Loop over cell arrays.


Just treat them like a normal array/matrix

data = {"something",[1 2;3 4],10};

for kk = 1:length( data )
        val = data{kk};
        body
endfor

-----Original Message-----
From: Sean Smith [mailto:address@hidden
Sent: Thursday, August 26, 2004 4:50 PM
To: 'address@hidden'
Subject: Loop over cell arrays.


It appears easy enough to loop over <structures> using

for [ key, value] = <structure>
  body
endfor

but I can't find any reference on how to loop over cell arrays.

Any suggestions?

Thanks,
Sean



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]