Indexing a group of vectors
Indexing a group of vectors
(OP)
I would like to know how I can create a 1D array whose elements are vectors of various dimensions. For example for some array of vectors v(m), I would like to be able to call on a single vector (e.g. v(0) or v(3)) whose respective size would be 1:n-m, where m=0:n-1. Any suggestions?





RE: Indexing a group of vectors
To answer your question, the only way to have differently sized rows in a 2D array is to make it a cell array:
v{1}=1:10;
v{2}=1:9;
v{3}=1:8;
% etc
You can access elements like this:
>> v{2}(3:5)
ans =
3 4 5
But... you can't do much with a cell array other than access its elements. Maybe you should be looking at the tril() and triu() functions instead?