How can I do the next iteration?

1 vue (au cours des 30 derniers jours)
muhammad muda
muhammad muda le 22 Mai 2019
Commenté : muhammad muda le 22 Mai 2019
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!

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 22 Mai 2019
Modifié(e) : KALYAN ACHARJYA le 22 Mai 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 commentaire
muhammad muda
muhammad muda le 22 Mai 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?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by