There some values are stored as 8.8744e+05 while checking the workspace. Is that a problem for doing bitxor operation. Those values are also considered as integers, right?
How to check whether all the elements are integer?
조회 수: 19 (최근 30일)
이전 댓글 표시
I had a vector of size (1 x 65536). How can i check whether all the elements in that vector is an integer.
채택된 답변
Von Duesenberg
2018년 4월 5일
check = [1 1.5];
logical(~rem(check,1))
댓글 수: 1
Peter H Charlton
2025년 2월 6일 14:19
편집: Peter H Charlton
2025년 2월 6일 14:20
This produces a logical array indicating whether each element is an integer. If you want to check whether all the elements in an array are integers, then I would suggest a slight edit:
check = [1 1.5];
sum(rem(check,1))==0 % check that there are no non-integers
check = [1 1];
sum(rem(check,1))==0 % check that there are no non-integers
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!