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
Re: Repeat loop - help
Posted: Sep 13, 2013 12:45 PM

>
> for c=1:10;
> D = maximin(n1,n2,'euclidean');
> M = min(D,[],2); ;
> C=[D M];
> [~, rowIdx] = max(C(:,end),[],1);
> n1(end+1,:) = n2(rowIdx,:);
> n2(rowIdx,:) = [];
> end
>
>
> I don't see how it can work at all -- you're taking n2(1,1:30) and
> appending it as a row to n1(51,1:50) in the assignment. That's a size
> mismatch that should fail.
>
> Also don't know what maximin returns, but doesn't seem it would be so
> that the returned index is even necessarily in 1:size(n2,1)
>

Sorry I got the matrix dimension wrong,
My n1=30*85
n2=50*85

maximin will return D=50*30 matrix (calculates distance between points in n1 and n2)
I hope it makes sense now!

Thanks

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