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: Mon, 10 Apr 2006 20:45:23 -0400 (EDT)

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

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

function retval = TranslateSBML()
  retval.b = "B";
  retval.c = makechildstruct();
endfunction

function retval = GetSubstruct()
  for i = 1:10
    retval(i).d = i;
  endfor
endfunction

The jist of what I'm trying to do is that I want to be able to end up with an index like

a.c(1).d

instead of

a.c{1}.d

as I currently get. I will also be creating sub-...-sub-structures, but I assume that will be a straight-up extension of whatever you show me here. I will also be needing (in a different function) to read out these sub-...-sub-structures. Is there a good source of documentation on how to use the Octave C++ types and classes (the header files seem bare of comments)?

I realize that my example C++ code is probably very wrong in a best coding practices sense (I'm learning C++ at the same time that I'm trying to write this).

Bill

--
"We'll give people IIS (It Isn't Secure) just so the script kiddies can
demonstrate the ability of Windows to do distributed computing in the form
of DDoS attacks."
  -- RAMMS+EIN



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