vectors from array

19 ビュー (過去 30 日間)
Gary
Gary 2011 年 12 月 14 日
What is the best way to create vectors from columns of an array?

採用された回答

David Young
David Young 2011 年 12 月 14 日
vector = array(:, column_number)
  5 件のコメント
Gary
Gary 2011 年 12 月 14 日
How can I get separate vectors such as V1, V2 and V3. Thanks
Paulo Silva
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
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

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by