How can I do the next iteration?

1 次查看(过去 30 天)
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!

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-5-22
编辑:KALYAN ACHARJYA 2019-5-22
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 个评论
muhammad muda
muhammad muda 2019-5-22
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?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by