help-octave
[Top][All Lists]
Advanced

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

assigning ColumnVector to struct in C++


From: matthias . bergmeister
Subject: assigning ColumnVector to struct in C++
Date: Thu, 08 Jun 2006 08:35:34 +0200


Hello,
here is what I want to do in a simplified example : I create the following data structure at the octave prompt:

structure.a=1;
structure.b=2;
structure.c=3;

data(1)=structure;
data(2)=structure;
data(3)=structure;

Now, I pass "data" to the following C++ program:

DEFUN_DLD (assignVector, args, , "assign vector to struct"){

if (!args(0).is_map()) error("argument must be of type struct");

 //create column vector
 ColumnVector aVector (2);
 aVector(0)= 1;
 aVector(1)= 2;

Octave_map returnStructure = args(0).map_value();

// HERE I WANT TO ASSIGN ColumnVector TO A CERTAIN ENTRY IN returnStructure
// i.e. I WANT TO THE SAME THAT THESE OCTAVE COMMANDS WOULD DO
// ColumnVector = [1;2];
//data(2).b = ColumnVector;

//return the modified structure to octave
return octave_value(returnStructure);
}

Thanks for your help
Matthias
reply via email to

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