From bug-request at octave dot org Wed Nov 24 21:20:06 2004 Subject: structure arrays From: "John W. Eaton" To: Paul Probert Cc: bug-octave at bevo dot che dot wisc dot edu Date: Wed, 24 Nov 2004 21:20:22 -0600 On 24-Nov-2004, Paul Probert wrote: | I'm having trouble trying to make structure arrays. | Under Octave 2.1.50 on Windows I can do this: | | >> x(1).item='some string'; | >> x(1).data=[1,2,3]; | >> x(2).item='another string'; | >> x(2).data=[5,6,7,8]; | >> x(1).item | ans = some string | >> x(2).data | ans = | | 5 6 7 8 | | | As we want. This is also what Matlab 6 does. | | | But on octave 2.1.59 on Linux, I get this: | | octave:6> x(1).item='some string'; | octave:7> x(1).data=[1,2,3]; | octave:8> x(2).item='another string'; | octave:9> x(2).data=[5,6,7,8]; | octave:10> | octave:11> x.item | ans = | | (, | [1] = some string | [2] = another string | ,) | | octave:12> x(1).item | error: string cannot be indexed with . | octave:12> x(2).data | error: matrix cannot be indexed with . | | I built octave on Linux (SuSE 8.2) using the enable-shared and | enable-dl options. Try a newer version. 2.1.63 is the current "testing" AKA "recommended" version, though there is one known problem with indexing with the "end" keyword. You can find a patch for that problem here: http://www.octave.org/mailing-lists/octave-maintainers/2004/877 There should be a 2.1.64 snapshot soon that will include this and a couple of other minor fixes. Thanks, jwe ------------------------------------------------------------- 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 -------------------------------------------------------------