isnumber

Version 1.0.0.0 (1,93 KB) von M MA
Enhanced version of isnumeric.
2K Downloads
Aktualisiert 13. Jan 2006

Lizenz anzeigen

Similar to isnumeric but checks length/size, NaNs and range (space). May be very useful in guis, to test user edit inputs...

Syntax:
IS = ISNUMBER(V,N,SPACE)
IS = ISNUMBER(V,SPACE)

Inputs:
V Data, N-D array
N Desired length or size
SPACE Allowed values (default is 'R'):
'Z' : integers, ..., -2, -1, 0, 1, 2, ...
'Z+' : positive integers, 1, 2 ,3, ...
'Z0+' : positive integers including zero, 0, 1, 2, 3, ...
'Z-' : negative integers, ..., -3, -2, -1
'Z0-' : negative integers including zero, ..., -2, -1, 0
'R' : reals (default)
'R+' : reals, positive, higher than zero
'R0+' : reals, positive including zero
'R-' : reals, negative, lower than zero
'R0-' : reals, negative, including zero
'C' : complexes, at least one element

Output:
IS Logical 0 or 1

Examples:
isnumber([1 2 3],3) % 1
isnumber([1 2 3]) % 1
isnumber('www') % 0
isnumber([1 2.1],'Z') % 0
isnumber(rand(3,4),[3 4]) % 1

Zitieren als

M MA (2024). isnumber (https://www.mathworks.com/matlabcentral/fileexchange/9571-isnumber), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R12
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

Increased help, added complex numbers, bug fix