isnumber.m

来自「实现地震勘探中」· M 代码 · 共 21 行

M
21
字号
function bool=isnumber(str)% Check if a string contains only numbers, spaces, commas, decimal points,% semicolons, +/- signs%% Written by: E. R.: August 16, 2003% Last updated: %%       bool=isnumber(str)% INPUT% str   string to be checked% OUTPUT% bool  logical variable; bool is set to false if it contains characters %       other than those listed above or if the string has length 0%       bool=true otherwiseif isempty(str)   bool=false;else   bool=all(ismember(double(str),double('1234567890,.; +-')));end

⌨️ 快捷键说明

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