필터 지우기
필터 지우기

Save matrix of each iteration

조회 수: 1 (최근 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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by