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: Jeff Abrahamson
Subject: Re: beginner question: returning matrix and other
Date: Wed, 22 Jun 2005 11:21:49 -0400
User-agent: Mutt/1.5.9i

On Wed, Jun 22, 2005 at 10:48:30AM -0400, Jeff Abrahamson wrote:
>   [31 lines, 106 words, 851 characters]  Top characters: -teo\nnsi
> 
> 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.

I finally realized that I need to declare the return value as a list
of things:

    function [a, b, c] = my_func(x, y)
      ...
      a = ...;
      b = ...;
      c = ...;
    end

rather than as a single thing:

    function d = my_func(x, y)
      ...
      d = [a, b, c];
    end

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



reply via email to

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