About isinteger command(confusion)
显示 更早的评论
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?
采纳的回答
更多回答(2 个)
Jan
2013-3-16
Joining the rounding with the checks for overflows:
function isf = isflint(m)
isf = (abs(m) <= bitmax && m == floor(m));
ChristianW
2013-3-14
doc isinteger
isinteger(int8(3))
5 个评论
C Zeng
2013-3-15
ChristianW
2013-3-15
isint = @(x) x==round(x)
C Zeng
2013-3-16
Jan
2013-3-16
@C Zeng: @(x) x==round(x) is an anonymous function. You find an exhaustive description ion the documentation.
C Zeng
2013-3-17
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!