determine loop which include cellarrays

1 回表示 (過去 30 日間)
sermet
sermet 2014 年 5 月 23 日
回答済み: Sara 2014 年 5 月 23 日
z=[1 2 3;4 5 6;7 8 9];
for i=1:3
w{i}=z(:,i)
end
w =
[3x1 double] [3x1 double] [3x1 double]
%I need to extract first row of w{1},w{2} and w{3} inside the loop after w like that;
n{1}=first row of w{1} n{2}=first row of w{2} n{3}=first row of w{3}

採用された回答

Sara
Sara 2014 年 5 月 23 日
z=[1 2 3;4 5 6;7 8 9];
w = cell(3,1);
n = cell(3,1);
for i=1:3
w{i}=z(:,i);
n{i}=w{i}(1,:);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by