フィルターのクリア

How to reduce writing using cat command?

4 ビュー (過去 30 日間)
Megha
Megha 2018 年 10 月 21 日
コメント済み: Walter Roberson 2018 年 10 月 22 日

Is there any way to reduce writing each time by any means..

y = cat(3, x{1,1}, x{1,2}, x{1,3}, x{1,4},...
    x{1,5}, x{1,6}, x{1,7}, x{1,8}, x{1,9},...
    x{1,10}, x{1,11}, x{1,12}); 

the command like

for i = 1:12
    y = cat(3, x{1,i});
end

does not work.

採用された回答

Kevin Chng
Kevin Chng 2018 年 10 月 21 日
Hi, play some trick will do.
x{1,1} = [1 1 3; 4 5 6];
x{1,2} = [1 2 3; 5 6 7];
x{1,3} = [1 2 3; 4 5 6];
y1 =[];
for i = 1:1:length(x)
y1 = cat(3,y1,cat(3,x{1,i}));
end
  1 件のコメント
Megha
Megha 2018 年 10 月 22 日
Thank you @ Kevin Chng it worked!

サインインしてコメントする。

その他の回答 (1 件)

Steven Lord
Steven Lord 2018 年 10 月 21 日
See the "How to Use the Comma-Separated List" section on this documentation page.

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by