在Matlab中查找函数返回值

时间:2013-05-06 08:23:18

标签: matlab find return-value

如果Matlab中的find()函数无法找到给定条件的任何内容,则会返回并清空1x0矩阵。如何检查是否确实如此 - 提供的矩阵中给定的标准是否满足?

1 个答案:

答案 0 :(得分:3)

查看isempty

b = [ 1 2 3 5 ]; 
a = find( b == 4 );
if isempty( a )
   fprintf(1,'not found\n');
end