help-octave
[Top][All Lists]
Advanced

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

Re: Need some help with Oct files


From: Michael Creel
Subject: Re: Need some help with Oct files
Date: Tue, 05 Sep 2006 15:38:07 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060812)



Philip Goh wrote:
Hi there,

I've been trying to get some code that I've written in Matlab as Mex modules ported into Octave oct modules. I've run into a slight problem that I hope people on this list would be able to help me with.

I have a function that returns multiple values. i.e. it is invoked like
[a,b,c] = myfunc(d);

I haven't been able to find a way of doing this multiple return in an oct file. Thus, right now, I'm putting everything into a column vector, and having myfunc return that instead. It's a work around, not too elegant but it works for now. Even so, I would still like to know how I'd go about setting up multiple return values in oct files?

cheers,
Philip


You need to return an octave_list_value. Something like the following (taken from samin.cc in octave-forge):

        f_return(0) = xopt;
        f_return(1) = fopt;
        f_return(2) = converge;
        return octave_value_list(f_return);

Cheers, Michael


reply via email to

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