Save matrix of each iteration

2 ビュー (過去 30 日間)
Sincloe Brans
Sincloe Brans 2013 年 9 月 16 日
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

採用された回答

Walter Roberson
Walter Roberson 2013 年 9 月 16 日
  1 件のコメント
Sincloe Brans
Sincloe Brans 2013 年 9 月 16 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by