Hello all,
I have a simple piece of code that I would like to get rid of the for loop. I would appreciate your help.
for n=1:K
idx=row((((n-1)*dc)+1):(n*dc));
end
where as an example K=4, dc=2, and row=[1;3;2;3;1;4;2;4];

 채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 28일

1 개 추천

t = reshape(row, dc, []);
idx = t(:,1:K);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

Mnr
2015년 11월 28일

댓글:

Mnr
2015년 11월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by