MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]矩阵的某行设置为空集? (https://www.labfans.com/bbs/showthread.php?t=6890)

muzili2008 2009-03-17 12:26

[求助]矩阵的某行设置为空集?
 
[SIZE="4"][SIZE="6"]a=[2:2:20;4:13;-3:3:24];
b=a>20;
[m,n]=size(b);
c=zeros(1,n);
for i=1:m
ip=isequal(c,b(i,:))
if islogical(ip)==1
a(i,:)=[];[SIZE="4"][SIZE="5"][/SIZE][/SIZE]
end
end


大家看一下 ,矩阵里面有大于20的数。程序就是找出来,并将这一行设置为空集。
我的怎么不能实现呀?[/SIZE][/SIZE]

zhyanchao 2009-03-18 00:22

回复: [求助]矩阵的某行设置为空集?
 
a=[2:2:20;4:13;-3:3:24];
b=logical(any(a>20,2));
a(b,:)=[]
以上程序就可以满足要求


所有时间均为北京时间。现在的时间是 03:11

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.