help-octave
[Top][All Lists]
Advanced

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

RE: beginner question: returning matrix and other


From: Hall, Benjamin
Subject: RE: beginner question: returning matrix and other
Date: Wed, 22 Jun 2005 11:14:56 -0400

Just list them directly in the function output argument list.  For example:

function [a,b] = mycoolfunction( n )

a = ones(n,n);
b = n;

return
endfunction


[thematrix,thescalar] = mycoolfunction(2)





-----Original Message-----
From: Jeff Abrahamson [mailto:address@hidden
Sent: Wednesday, June 22, 2005 10:49 AM
To: address@hidden
Subject: beginner question: returning matrix and other


I have a function that wants to return a matrix and a scalar.  The
most obvious way to do this doesn't work.  Am I missing something?
Using cell's seems overkill.

    octave:45> a=ones(2,2)
    a =

      1  1
      1  1

    octave:46> b=3
    b = 3
    octave:47> [a,b]
    error: number of rows must match (1 != 2) near line 47, column 4

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B



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