[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Returning more than one argument from OCT file
From: |
David Bateman |
Subject: |
Re: Returning more than one argument from OCT file |
Date: |
Mon, 31 Jan 2011 21:45:06 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090706) |
jayt0808 wrote:
> Hi all,
>
> I have been looking for an answer to a very simple question:
>
> How do I return more than one argument from an octave C++ function.
>
> The following is a simple example of a function that returns a single
> argument. How do I modify it to return a 2nd argument of different type?
>
> #include <octave/oct.h>
>
> DEFUN_DLD(matMult,args, , "Test function.")
> {
> ComplexMatrix a(args(0).complex_matrix_value());
>
> Matrix b(args(1).matrix_value());
>
> ColumnVector c(args(2).vector_value());
>
> return octave_value(a*2);
> }
>
> I would be inclined to create a octave_value_list object that contains more
> than one thing. But it is not clear how to do that.
>
> Thanks to anyone willing to rescue me here.
>
> Jay
>
>
DEFUN_DLD(matMult,args, , "Test function.")
{
octave_value_list retval;
ComplexMatrix a(args(0).complex_matrix_value());
Matrix b(args(1).matrix_value());
ColumnVector c(args(2).vector_value());
retval(2) = octave_value(c);
retval(1) = octave_value (b)
retval(0) = octave_value (a);
return retval;
}
--
David Bateman address@hidden
35 rue Gambetta +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)