From help-octave-request at bevo dot che dot wisc dot edu Tue Apr 29 08:42:48 2003 Subject: Re: Replacement of struct_elt_ref From: Laurent Mazet To: help-octave at bevo dot che dot wisc dot edu Date: Tue, 29 Apr 2003 15:41:32 +0200 On Mon, 28 Apr 2003 22:39:33 -0400 Paul Kienzle wrote: > Laurent Mazet wrote: > >Helo, > > > >I used to use struct_elt_ref method to extract data field from a structure in my C++ oct-file. Since 2.1.4x, this method disapears. Does anyone knows how to deal with structures in new version ? ... > > It looks like you should be able to use > > octave_value map = args(0); > octave_value el = map.single_subsref > (".",octave_value_list(octave_value("field"))); > At least, I found an elegant way to do it: /* OCTAVE_VERSION == 2.0.x */ Matrix strans = args(3).struct_elt_ref("strans").matrix_value(); /* OCTAVE_VERSION <= 2.1.36 */ #include Matrix strans = args(3).struct_elt_ref("strans").value().matrix_value(); /* OCTAVE_VERSION > 2.1.36 */ #include Octave_map map = args(3).map_value(); Matrix strans = map["strans"](0).matrix_value(); I think this summary might help. Laurent -- Dr. Laurent Mazet: Research Engineer /V\ Centre de Recherche de MOTOROLA Tel: +33 (0)1 69 35 48 30 =-=-=-=-=-=-=-=-=-=-= Email: mazet at crm dot mot dot com ------------------------------------------------------------- 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 -------------------------------------------------------------