help-octave
[Top][All Lists]
Advanced

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

Re: Octave_map and vectors


From: Geraint Paul Bevan
Subject: Re: Octave_map and vectors
Date: Tue, 28 Oct 2003 16:17:41 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John W. Eaton wrote:

| Yes, this works, but why would you want to do that when Octave_map is
| already capable of holding structure arrays?
|
| jwe


I didn't realise that Octave_map was capable of this! Well this looks
much better then:


// -*-c++-*-
// test.cc

#include <octave/oct.h>
#include <octave/oct-map.h>

DEFUN_DLD (test, args, , "test")
{
~  Octave_map retval;
~  octave_value_list names, types;

~  names(0) = "hello";
~  names(1) = "world";

~  types(0) = "int32";
~  types(1) = "int32";

~  retval.assign("name", names);
~  retval.assign("type", types);

~  return octave_value(retval);
}


Are there any further improvements I could make to this?

- --
Geraint Bevan
http://www.mech.gla.ac.uk/~gbevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iEYEARECAAYFAj+elqQACgkQcXV3N50QmNPnrwCeJZ3SM0nTMcttuE4XeE5LqyRr
3GQAn1507ZqQxBSw0jNQ3hx2QEsCqGRQ
=Qenb
-----END PGP SIGNATURE-----



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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