필터 지우기
필터 지우기

How do a write a loop code in MATLAB?

조회 수: 5 (최근 30일)
N/A
N/A 2018년 11월 26일
편집: Stephen23 2018년 11월 26일
How do I impliment a "for loop" into this code?
for r = 1 : numPlotsR
for c = 1 : numPlotsC
subplot(numPlotsR, numPlotsC, plotIndex);
rgbBlock = ca{r,c}; imshow(rgbBlock);
[rowsB, columnsB, numberOfColorBandsB] = size(rgbBlock);
caption = sprintf('Block #%d of %d\n%d rows by %d columns', ...
plotIndex, numPlotsR*numPlotsC, rowsB, columnsB);
title(caption); drawnow;
xlswrite(NewID,rgbBlock);
plotIndex = plotIndex + 1;
img1=rgbBlock;
imshow(img1)
  댓글 수: 1
Bob Thompson
Bob Thompson 2018년 11월 26일
I don't understand your question. You have two for loops set up already for the code. What do you mean by, "impliment a 'for loop' into this code?"

댓글을 달려면 로그인하십시오.

채택된 답변

Jim Riggs
Jim Riggs 2018년 11월 26일
편집: Jim Riggs 2018년 11월 26일
A "for" loop requires an "end" statement:
for r=1:numPlotsR
for c=1:numPlotsC
...
...
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by