MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在Matlab中确定矩阵是否为空? (https://www.labfans.com/bbs/showthread.php?t=22625)

poster 2019-12-10 16:49

如何在Matlab中确定矩阵是否为空?
 
在我的matlab程序中,我想确定变量或函数的输出是否为空,然后再继续。

实际上,我已经编写了一个函数来计算两个线段之间的交点。如果没有交集,则该函数不返回任何内容(因此,该函数分配的变量将为空矩阵)。

我知道我可以使用size函数,但是还有更好的方法吗?


回答:
您可以使用[URL="http://www.mathworks.com/help/matlab/ref/isempty.html"]isempty[/URL] 。例如:

>> isempty([]) ans = 1 >> isempty([42]) ans = 0

[url=https://stackoverflow.com/questions/674474]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:33

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