help-octave
[Top][All Lists]
Advanced

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

Re: Data Structure Question


From: Paul Kienzle
Subject: Re: Data Structure Question
Date: Sat, 10 Jan 2004 16:08:36 -0500

You have a ';' in comment and a ',' varname which is why it doesn't work
like you expect. You will be better off using {} rather than [] for an array
of strings because you can then use x.comment{i} rather than
deblank(x.comment(i,:)) to reference them.  You need the deblank
for [] because a character matrix must be rectangular.  You don't
need it for {} because a vector of values can contain character vectors
of different lengths.

Paul Kienzle
address@hidden

On Jan 10, 2004, at 1:27 PM, Henry F. Mollet wrote:

Am I on the right track here for the use of a data structure? I'd like to add variable names (columns) and comments (rows) to a matrix a. It seems to
work for the comments but not the varnames.
Henry


octave:13> x.a = [1,2;3,4];
octave:14> x.comment = ["FirstRowComment"; "SecondRowComment"];
octave:15> x.varname = ["Var1", "Var2"];
octave:16> x
x =
{
  a =

    1  2
    3  4

  comment =

FirstRowComment
SecondRowComment

  varname = Var1Var2
}



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




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