help-octave
[Top][All Lists]
Advanced

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

Re: Vectors of Structures in C++


From: Bill Denney
Subject: Re: Vectors of Structures in C++
Date: Tue, 11 Apr 2006 05:26:15 -0400 (EDT)

That worked just like I wanted, thanks.

Bill

On Mon, 10 Apr 2006, John W. Eaton wrote:

Try this:

 #include <octave/oct.h>
 #include <octave/Cell.h>
 #include <octave/oct-map.h>

 octave_value
 GetSubstruct (void)
 {
    Octave_map m;

    Cell tmp (dim_vector (10, 1));

    for (int i = 0; i < 10; i++)
      tmp(i) = i+1;

    m.assign ("d", tmp);

    return m;
 }

 DEFUN_DLD (TranslateSBML, , ,
   "TranslateSBML")
 {
    Octave_map m;

    m.assign  ("b", "B");
    m.assign ("c", GetSubstruct ());

    return octave_value (m);
 }

jwe


--
"Don't ever take a city for granted.
"After all, it is bigger than you are; it is older; and it has learned
how to wait..."
  -- Neil Gaiman



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