From help-request at octave dot org Mon Apr 10 19:11:19 2006 Subject: Re: Vectors of Structures in C++ From: "John W. Eaton" To: Bill Denney Cc: Jordi Gutierrez Hermoso , help@octave.org Date: Mon, 10 Apr 2006 20:10:58 -0400 On 10-Apr-2006, Bill Denney wrote: | On Mon, 10 Apr 2006, Jordi Gutierrez Hermoso wrote: | | > On 4/9/06, Bill Denney wrote: | >> I'm wanting to make a vector of structures | > | > I'm not sure if I'm understanding your question, but will a simple | > answer like using the Standard Template Library vector class satisfy | > your needs? | | I don't think so, but let me try to explain what I'm wanting a bit | better, and maybe you can tell me if it will work (and perhaps give an | example of how to do it): | | I am currently doing something like | | DLD_FUNCTION(TranslateSBML, argsIn, , "") { | octave_value_list retval; | | Octave_map a; | a.assign("foo", 123); | a.assign("bar", GetSubstruct()); | | return retval; | } | | octave_value_list GetSubstruct() { | Octave_map tmp; | octave_value_list substruct; | | for (int i=0; i < 10; i++) { | tmp.assign("a", i); | substruct(i) = tmp; | } | | return substruct; | } | | I want substruct to be a struct vector instead of a cell vector. How do I | do that? It's not clear to me exactly what data structure you are trying to create here. Can you post some Octave code that creates a small structure with the key elements that you would like to construct using C++? jwe ------------------------------------------------------------- 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 -------------------------------------------------------------