isnumeric_str.m

来自「matlab源代码」· M 代码 · 共 21 行

M
21
字号
function [bool,value]=isnumeric_str(str)
% Check if a string represents a number
% Written by: E. R.: February 23, 2004
% Last updated:
%
%        bool=isnumeric_str(str)
% INPUT
% str    string
% OUTPUT
% bool   logical variable; set to logical(1) if the string represents a numeric value
%        and to logical(0) if it does not or has length zero

value=str2num(str);
if isempty(str) || isempty(value)
   bool=logical(0);
else
   bool=logical(1);
end
      

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?