How to code to get this output
2 ビュー (過去 30 日間)
古いコメントを表示
xt=[1 2 3 4 5 6 7 8 9 10 11]
for m=1:25
Output supposely
xt1 = [1 2 3 4 5 6 7 8 9 10 11]
xt2 =[1 2 3 4 5 6 7 8 9 10 11]
.
.
.
.
.
.
.
xt25 =[1 2 3 4 5 6 7 8 9 10 11]
What should i do to get this output
1 件のコメント
回答 (1 件)
Birdman
2018 年 4 月 5 日
Do not dynamically create variables. It is not recommended. Instead, use a multidimensional array:
for m=1:25
xt(:,:,m)=1:11;
end
1 件のコメント
Greg
2018 年 4 月 5 日
Why the loop, and why the third dimension?
xt = repmat(1:11,25,1);
Or
xt = repmat(1:11,1,1,25); % If you really want the third dimension
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!