For loop help!
조회 수: 5 (최근 30일)
이전 댓글 표시
I need helpt with a for loop to pick numbers from a vector and put them in an existing non square in the order shown in the figure below (hop it makes sense). It starts at the dot and then follow the arrow. the resulting matrix should be as the one in the blackbackgrownd figure.
Sorry if this has been asked before <3 .
Thank you.
댓글 수: 6
James Tursa
2020년 11월 18일
Start with 3 and increment by 3's, then start with 2 and increment by 3's, then start with 1 and increment by 3's?
답변 (1개)
Stephen23
2020년 11월 18일
"... so becase of the amount of data i need a for loop"
I doubt that using a loop would be a good approach.
V = 1:12;
R = 3;
M = flipud(reshape(V,R,[]))
Your larger vector:
V = rand(118668,1);
R = 9889;
M = flipud(reshape(V,R,[]));
size(M)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!