How can I extract column vectors from matrix (with large number of columns) ?
Show older comments
Having a lot of columns, this way of extracting from a big matrix named C :
temperature = C(:,1);
index = C(:,2);
...
vu = C(:,35);
results, in this example, in 35 lines of matlab program ; is there a solution like
[temperature, index, ... , vu] = C;
Where left side is a "list" of (column) vectors ? If so, my program would be more compact and readable. Thank you.
Accepted Answer
More Answers (1)
Honglei Chen
on 20 Sep 2012
Here is a simple example. Not sure if it's exactly what you want, but it may get you started
x = magic(3)
y = mat2cell(x,size(x,1),ones(1,size(x,2)))
[a,b,c] = deal(y{:})
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!