[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lists and cell arrays ?
From: |
Michael Creel |
Subject: |
lists and cell arrays ? |
Date: |
Tue, 18 Nov 2003 11:48:29 +0100 |
User-agent: |
KMail/1.5.4 |
Hello all,
I see that lists are deprecated in Octave 2.1.51. I have been using lists,
nth(), and leval (from Octave Forge) quite a bit. I'm wondering how to best
adapt my code. Two specific questions:
Question 1:
what's the best way to do something like
a = 2;
b = rand(2,1);
c = list(a,b);
using cell arrays? As far as I can see you need to something like
a = 2;
b = rand(2,1)l
c = cell(2,1);
c(1) = a;
c(2) = b;
Question 2:
When one extracts a piece of a cell, the result is a cell, e.g.,
a = rand(2,1);
b = cell(1);
b(1) = a;
a = b(1); # here, a is now a cell that contains a 2x1 vector.
c = rand(2,1);
a'*c; # this fails - a is a 1x1 cell, and c is a 2x1 vector
So the question is how to convert "a" back to being a 2x1 vector. What I need
is something like the "nth" function that operates on lists, as in
a = rand(2,1);
b = list(a);
a = nth(b,1);
c = rand(2,1);
a'*c; # this works, because "a" is a 2x1 vector
Thanks, Michael
-------------------------------------------------------------
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
-------------------------------------------------------------
- lists and cell arrays ?,
Michael Creel <=
- lists and cell arrays ?, John W. Eaton, 2003/11/18
- Re: lists and cell arrays ?, David Bateman, 2003/11/18
- Re: lists and cell arrays ?, taltman, 2003/11/19
- Re: lists and cell arrays ?, John W. Eaton, 2003/11/19
- Re: lists and cell arrays ?, taltman, 2003/11/19
- Re: lists and cell arrays ?, John W. Eaton, 2003/11/19
- Re: lists and cell arrays ?, taltman, 2003/11/19
- Re: lists and cell arrays ?, taltman, 2003/11/19