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!