MATLAB: How to do the next iteration

for loops

Hi,
My coding is basically on clustering four dimensional data. I have 4×4 matrix and I am computing the distance between the rows. You may see them in the coding.
But how can I repeat the whole process again? I mean with the new value of Mmax and Mmin.
The second question is, as in my first comment in the coding.
Thank you!

Best Answer

  • But how can I repeat the whole process again? I mean with the new value of Mmax and Mmin.
    clc;
    n= any number (how many times you want to repeat)
    for i=1:n
    Mmax=input('Enter new M array');
    %% Your code start from
    Mmin=Mmax
    ......
    .....
    end
    Please note that, after that its having multiple for loops, whcih may increse computation time.
    Another way defined Mmax with cell array, where you can defined multtiple Mmax and call individually Mmax{1}, Mmax{2}.....