Matlab:如何在 excel 中比较 num 与 num of excel >它使我的代码错误
Matlab : How to compare num with num of excel without compare character in excel>it make my code error
示例:
我有 excel.
的号码 123456
我有一条来自 ocr 的文本是“123456”。我用str2num换成num是123456
如果 flie excel 没有字符,我已经可以比较 num 和 num 了。
但如果文件 excel 的行或列中有字符。它说错误
如果我只想比较数字,如何解决这个问题。我不想比较
字符。
str2num
returns 如果无法将字符串转换为数字,则为空矩阵。所以你可以检查这个:
r = str2num('55');
if ~isempty(r)
disp('r is number')
else
disp('r is empty')
end
示例: 我有 excel.
的号码 123456我有一条来自 ocr 的文本是“123456”。我用str2num换成num是123456
如果 flie excel 没有字符,我已经可以比较 num 和 num 了。
但如果文件 excel 的行或列中有字符。它说错误
如果我只想比较数字,如何解决这个问题。我不想比较
字符。
str2num
returns 如果无法将字符串转换为数字,则为空矩阵。所以你可以检查这个:
r = str2num('55');
if ~isempty(r)
disp('r is number')
else
disp('r is empty')
end