How to code to get this output
조회 수: 12 (최근 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!