Using a cell entry to access part of a matrix
Iai Masafumi ax
iai at axelspace.com
Mon Nov 7 02:43:17 CET 2011
Hi,
Could anyone tell me if, in the codes below, there is any way to make
"y(II(1))" work without error, just like "y(ii)"? I wanted to access a
part of a matrix by using an entry of a cell. I think it is a pretty
intuitive way of using a cell.
//--------------------------
y=[100:110]
ii=[1 3 5 7];
jj=[2 4 6 8];
y(ii) // OK. This is an ordinary way.
II=cell(2,1);
II.entries(1)=ii;
II.entries(2)=jj;
II(1)
y(II(1)) // <-- ERROR
y(II.entries(1)) // OK. But not as concise as I see the benefit of using
cells.
//--------------------------
Thanks,
Iai
More information about the users
mailing list