How can I do the next iteration?

1 view (last 30 days)
Hi,
My coding is basically on clustering four dimensional data. I have 4x4 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!

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 22 May 2019
Edited: KALYAN ACHARJYA on 22 May 2019
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}.....
  1 Comment
muhammad muda
muhammad muda on 22 May 2019
Thank you Kalyan for your help.
By the way do you hve any idea about my 2nd question, regarding the for loop (i and j). Actually I only need to compute the difference between row 1 and 2, row 1 and 3, row 1 and 4, then row 2 and 3, 2 and 4 and so on. But the one that I did is computing all rows including the diagonal and repeating (1 and 2, and 2 and 1).
How to make it more efficient?

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!