How do a write a loop code in MATLAB?

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 comentario

Bob Thompson
Bob Thompson el 26 de Nov. de 2018
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?"

Iniciar sesión para comentar.

 Respuesta aceptada

Jim Riggs
Jim Riggs el 26 de Nov. de 2018
Editada: Jim Riggs el 26 de Nov. de 2018

0 votos

A "for" loop requires an "end" statement:
for r=1:numPlotsR
for c=1:numPlotsC
...
...
end
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

N/A
el 26 de Nov. de 2018

Editada:

el 26 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by