Info

This question is closed. Reopen it to edit or answer.

How do I create a loop in which one variable doesn't increase until another has reached it's specified limit?

1 view (last 30 days)
I am writing script to perform a block matching algorithm, I have 2 cell arrays (C&D) which contain parts of two images split into blocks, in part of the script the for loop below is used to compare each element of array D, to each one in array C, so D{1,1} is compared to every element of C and so on. When I run the script m,n&p both increase to their limits after the first loop and then m increases by one after each loop. Can someone explain how to alter the code so that after the first loop m&n are both at 1, and then after 6 loops n will have increased to 6, which will then cause m to increase to 2 in the next loop.
for m=1:5
for n=1:6
for o=1:5
for p=1:6
savd(o,p)=calculateSAVD(D{1,n},C{o,p});
S{o,p}=savd;
end
end
end
end
Thanks in advance!

Answers (0)

Community Treasure Hunt

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

Start Hunting!