help-octave
[Top][All Lists]
Advanced

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

determining number of matrices passed to function


From: Evan Cooch
Subject: determining number of matrices passed to function
Date: Mon, 11 Feb 2002 12:14:17 -0500

Considering switching over from MATLAB to Octave, and while most of my m-files are porting fairly seamlessly, there is one thing that is causing some problems.

I make fairly frequent use of what MATLAB knows as 'cell arrays'. For example, suppose I have 2 matrices: A and B. I can put them into a cell array (called MAT) using

MAT={A;B};

I can then pass MAT to a function, where I can use the length command to determine the number of matrices in the cell array. In this example, length(MAT) yields 2.

However, this doesn't seem to work in Octave. If I try

MAT={A;B},

and then length(MAT), I get -1 -1 returned.

Hmmm...strange.

Any suggestions? I often pass sets of matrices to functions, and need to be able to have the function count the number of arrays being passed. The length command in MATLAB applied to a cell array works perfectly for this task - equivalent in Octave?

Thanks in advance...


----------------------------------------------------------------------
 Evan Cooch                          e.mail: address@hidden
 Department of Natural Resources     voice: 607-255-1368
 Fernow Hall - Cornell University    FAX: 607-255-8837
 Ithaca, NY    14853                 http://canuck.dnr.cornell.edu
----------------------------------------------------------------------
Yogi Berra's explanation of frequency dependence: 'No one goes there anymore because its too crowded'.



-------------------------------------------------------------
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]