vectors from array
6 次查看(过去 30 天)
显示 更早的评论
What is the best way to create vectors from columns of an array?
0 个评论
采纳的回答
David Young
2011-12-14
vector = array(:, column_number)
5 个评论
Paulo Silva
2011-12-14
see my Answer and http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
更多回答(1 个)
Paulo Silva
2011-12-14
a=randi(5,3,5) %sample array
%put all columns of the array in diferent cells
b=arrayfun(@(x)a(:,x),1:size(a,2),'uni',0);
c=1; %choose the column
v=b{c} %get the vector of that column
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!