mttIsNumericText.m 748 B

1234567891011121314151617181920212223
  1. function boolean = mttIsNumericText(text)
  2. if any(abs(text)==39)
  3. % MATLAB doesn't like apostrophes in text
  4. boolean = 0 ;
  5. elseif strcmp(text,'flow')
  6. % MATLAB invokes built-in function "flow" rather than treating it as text in str2num(text) !!!
  7. boolean = 0 ;
  8. elseif strcmp(text,'error')
  9. % MATLAB invokes built-in function "error" rather than treating it as text in str2num(text) !!!
  10. boolean = 0 ;
  11. else
  12. num = str2num(text) ;
  13. if isempty(num)
  14. boolean = 0 ;
  15. % ... contains non-numeric characters other than stand-alone "i" or "j"
  16. else
  17. boolean = isreal(num) ;
  18. % ... doesn't contain stand-alone "i" or "j"
  19. end
  20. end