Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Repeat loop - help
Replies: 3   Last Post: Sep 13, 2013 12:45 PM

 Messages: [ Previous | Next ]
 John Dickson Posts: 19 Registered: 10/30/11
Repeat loop - help
Posted: Sep 13, 2013 5:28 AM

Hello Experts,
I need help on repeating a set of code 10 times, any ideas how it can be done.
So i have this following code which starts with n1=50*50 and n2=30*30, at the end of this program n1=51*50 and n2=29*30.
I need to repeat this 10 times, so that at the end I should get, n1=60*50 and n2=20*30.
Any thoughts?

D = maximin(n1,n2,'euclidean');
M = min(D,[],2); ;
C=[D M];
[maxValue, rowIdx] = max(C(:,end),[],1); %max value and the row index
n1(end+1,:) = n2(rowIdx,:); %Copy selected row to bottom of n1
n2(rowIdx,:) = [];

Thanks

Date Subject Author
9/13/13 John Dickson
9/13/13 John Dickson
9/13/13 dpb
9/13/13 John Dickson