How do a write a loop code in MATLAB?

5 次查看(过去 30 天)
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