From help-request at octave dot org Fri Feb 11 07:20:59 2005 Subject: how to access structure elements by a key From: Rafal Mantiuk To: help at octave dot org Date: Fri, 11 Feb 2005 14:23:33 +0100 This is a multi-part message in MIME format. --------------070501020604010209090103 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, How can I access an element of the structure by its key if the key is given as a string. That is, having a structure: a.a = 1; I would like to get "1", by: a("a") or something similar. Actually a("a") causes an error and then assertion fault and octave crash on 2.1.57: error: string type invalid as index value octave: ../liboctave/dim-vector.h:104: int& dim_vector::dim_vector_rep::elem(int): Assertion `i >= 0 && i < ndims' failed. I need such functionality to copy only selected elements from one structure to another structure while I don't really know what are the names (keys) of the elements in the first structure. Thanks, Rafal --------------070501020604010209090103 Content-Type: text/x-vcard; charset=utf-8; name="mantiuk.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mantiuk.vcf" begin:vcard fn:Rafal Mantiuk n:Mantiuk;Rafal org;quoted-printable:Max-Planck-Institut f=C3=BCr Informatik;Computer Graphics Group adr;quoted-printable:;;Stuhlsatzenhausweg 85;Saarbr=C3=BCcken;;66123;Germany email;internet:mantiuk at mpi-sb dot mpg dot de tel;work:+49 681 9325-427 tel;fax:+49 681 9325-499 x-mozilla-html:FALSE url:http://www.mpi-sb.mpg.de/~mantiuk/ version:2.1 end:vcard --------------070501020604010209090103-- ------------------------------------------------------------- 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 -------------------------------------------------------------