How can I do the next iteration?

1 visualización (últimos 30 días)
muhammad muda
muhammad muda el 22 de Mayo de 2019
Comentada: muhammad muda el 22 de Mayo de 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!

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 22 de Mayo de 2019
Editada: KALYAN ACHARJYA el 22 de Mayo de 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 comentario
muhammad muda
muhammad muda el 22 de Mayo de 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?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by