|
From: | David Grundberg |
Subject: | Re: How Do I Create a Map With Indexed Values in an Oct File |
Date: | Thu, 08 Apr 2010 12:00:53 +0200 |
User-agent: | Thunderbird 2.0.0.23 (X11/20090812) |
Thomas D. Dean wrote:
I want to create a map in an oct file like the octave code: x.a=1; x.b=2; a.h{1}=x; x.a=11; x.b=12; a.h{2}=x; a.idx=2; in f.cc, I can do Octave_map s, t; s.assign("a",1); s.assign("b",2); t.assign("h",x); ## this is not what I want s.assign("a",11); s.assign("b",12); t.assign("j",x); ## this is not what I want After mkoctfile, in octave, I want to do a=f(); and get the same results as the octave code. I can extract values with for i=1:a.idx a.h{i} endfor How do I do this? tomdean
Create a 2-element cell array (Cell), add the s's to it, and use t.assign("h", the-cell-array);
hth, David
[Prev in Thread] | Current Thread | [Next in Thread] |