Borrar filtros
Borrar filtros

Save matrix of each iteration

1 visualización (últimos 30 días)
Sincloe Brans
Sincloe Brans el 16 de Sept. de 2013
I have the following code:
for c=1:10;
D = maximin(n2,n1,'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,:) = []; %Delete the row from n2 that has the maximin
c=c+1;
end
n1 is 50*80 and n2 is 100*80 At the end of first iteration n1=51*80 and n2=49*80 and so on. I need to see save the n1 at the end of each iteration, so that I can use n1(1) ... n1(10) for further calculation. Please help. I treid B = cell(1, c); B(n) = n1(1, c+1); Didn't help. Any help is very much appreciated.
Thanks

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Sept. de 2013
  1 comentario
Sincloe Brans
Sincloe Brans el 16 de Sept. de 2013
Thanks for the answer. It kind of works, the n1...n10 are withing B matrix. In other words, B is 1*10 cell, each cell has each of the n's. Not sure how to split or separate them so that B1, B2... corresponds n1, n2 etc.

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.

Community Treasure Hunt

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

Start Hunting!

Translated by