Fill a matrix after an iteration
1 次查看(过去 30 天)
显示 更早的评论
Hi, given the following code:
PPP=[ 18 19 20 13 18 16 19 3 2 3 3 2 2 2 1 2 1 2 1 2 1 4 2 4 2 4 2 4 2 4 8 1 1 1 1 8 4;
18 19 20 13 18 16 19 3 2 3 3 2 2 2 1 8 1 2 1 2 1 4 2 4 2 4 2 4 2 4 8 1 1 1 1 8 4;
18 19 20 13 18 16 19 3 4 3 3 2 2 2 1 8 1 2 1 2 1 4 2 4 2 4 2 4 2 4 8 1 1 1 1 8 2;
18 19 20 13 18 16 19 3 2 3 3 2 1 1 1 2 1 2 1 2 1 4 2 4 2 4 2 4 2 4 8 1 4 8 8 8 4];
nrawD = size (PPP,1);
ncolD = size (PPP,2);
for kk= 1:nrawD;
....
for ii=1:...;
...
TMR(ii,:) = ...; % is an array of 0 and 1.
...
end
end
E=sum(TMR(:) == 1) % find how many 1 are inside TMR
if E > 6
continue
else
TM(kk,:)=TMR; % I want to report the array TMR in the matrix TM just when E<6.
end
end
I want to fill a matrix TM with the arrays TMR that are created at each iteration. But I want to fill TM just with the TMR that has a value of E < 6.
I don't know how but I can't have what I want. Probably the error is here
if E > 6
disp('su')
else
TM(kk,:)=TMR;
end
May someone help me?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!