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));
댓글 수: 1
per isakson
2013년 3월 18일
I'll replace my cryptic isflint.
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!