About isinteger command(confusion)
Ältere Kommentare anzeigen
Hi, by the command of isinteger I can check if it is an integer, however, when defined at first, Matlab assume it is double precision right? So even a=3, isinteger(a) returns 0.
How to solve this problem?
Akzeptierte Antwort
Weitere Antworten (2)
Jan
am 16 Mär. 2013
Joining the rounding with the checks for overflows:
function isf = isflint(m)
isf = (abs(m) <= bitmax && m == floor(m));
1 Kommentar
per isakson
am 18 Mär. 2013
I'll replace my cryptic isflint.
ChristianW
am 14 Mär. 2013
doc isinteger
isinteger(int8(3))
5 Kommentare
C Zeng
am 15 Mär. 2013
ChristianW
am 15 Mär. 2013
isint = @(x) x==round(x)
C Zeng
am 16 Mär. 2013
Jan
am 16 Mär. 2013
@C Zeng: @(x) x==round(x) is an anonymous function. You find an exhaustive description ion the documentation.
C Zeng
am 17 Mär. 2013
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!