help-octave
[Top][All Lists]
Advanced

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

Re: MATLAB cells data structure


From: A. Scottedward Hodel
Subject: Re: MATLAB cells data structure
Date: Tue, 13 Apr 1999 07:21:56 -0500

>
>     Greetings,
>     
>     Could you let me know if the "cells" data structure that occurs in 
>     MATLAB is available within octave. ie expressions like:
>     
>     output{1}='hi there';
>     output{2}=2;
>     output{3}=zeros(3,3);
>     
>     The version of octave I am using (2.0.13, mips-sgi-irix6.2) does 
>     not recognise the above MATLAB syntax.
>     
>     Regards
>     
>     Ian Stott
>     
>     address@hidden
>

No.  The main Octave distributions (2.0.13.xx) have two data types:
matrices(numerical and string) and a C-like data structure.
The "bleeding-edge" releases have an additional data type, a "list",
which is the most "cell" like but is a one-dimensional array of arbitrary
(or even mixed type) objects.  Example:

octave:1> a = str2mat("joe","friday");
octave:2> b = rand(3,4);
octave:3> c.items = 2;
octave:4> c.values = [3 4];
octave:5> mylist = list(a,b,c)
mylist =
(
  [1] =

joe
friday

  [2] =

    0.607321  0.866821  0.782359  0.929332
    0.415340  0.090169  0.502734  0.659080
    0.152794  0.155840  0.795299  0.704957

  [3] =
  {
    values =

      3  4

    items = 2
  }
)
octave:6> third_item = nth(mylist,3)
third_item =
{
  values =

    3  4

  items = 2
}   

A S Hodel Assoc. Prof. Dept Elect Eng, Auburn Univ,AL  36849-5201
On leave at NASA Marshall Space Flight Center (256) 544-1426
Address until 15 Mar 2000:Mail Code ED-13, MSFC, Alabama, 35812
http://www.eng.auburn.edu/~scotte



reply via email to

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