help-octave
[Top][All Lists]
Advanced

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

How Do I Create a Map With Indexed Values in an Oct File


From: Thomas D. Dean
Subject: How Do I Create a Map With Indexed Values in an Oct File
Date: Wed, 07 Apr 2010 23:18:21 -0700

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]