Azzera filtri
Azzera filtri

Save matrix of each iteration

1 visualizzazione (ultimi 30 giorni)
Sincloe Brans
Sincloe Brans il 16 Set 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

Risposta accettata

Walter Roberson
Walter Roberson il 16 Set 2013
  1 Commento
Sincloe Brans
Sincloe Brans il 16 Set 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by