help-octave
[Top][All Lists]
Advanced

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

RE: List question


From: Julian A. de Marchi, Ph.D.
Subject: RE: List question
Date: Tue, 12 Sep 2000 00:07:27 -0400

Your question is actually related to the implementation of "cells" or "cell
arrays", introduced with Matlab v.5.2 (if not earlier).  Cells are
tremendously useful since they obviate the need for "padding" of otherwise
undefined or empty spaces typical of matrix-based storage, and since
different types can be intermixed within the same storagae class.  Alas,
Octave is not yet so far(?) along.  It seems to me the simplest way to
implement a cell structure upon existing Octave infrastructure, would be to
encode any type in string form and pack it all into one string.  In some
respects this is reminiscent of BASIC optimisations...

julian

: -----Original Message-----
: From: address@hidden
: [mailto:address@hidden Behalf Of Teemu Ikonen
: Sent: Monday, September 11, 2000 08:06
: To: address@hidden
: Subject: List question
:
:
:
: Is list-element subindexing implemented in Octave 2.1?
:
: In matlab the following works:
: >>  l = {ones(2,2), zeros(2,2), hilb(2)}
: l =
:     [2x2 double]    [2x2 double]    [2x2 double]
: >> l{3}(1,2)
: ans =
:     0.5000
:
: The same in octave fails:
: octave:9> l = {ones(2,2), zeros(2,2), hilb(2)}
: l =
:
:   [1,1] =
:
:     1  1
:     1  1
:
:   [1,2] =
:
:     0  0
:     0  0
:
:   [1,3] =
:
:     1.00000  0.50000
:     0.50000  0.33333
:
: octave:10> l{3}(1,2)
: error: invalid column index = 2
:
: Any plans of fixing this? Of course I could copy the matrix to a temp
: variable and then access the matrix element but that's really
: unelegant...
:
: Teemu
:
:
:
:
: -----------------------------------------------------------------------
: Octave is freely available under the terms of the GNU GPL.
:
: Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
: How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
: Subscription information:  http://www.che.wisc.edu/octave/archive.html
: -----------------------------------------------------------------------
:



-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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