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?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sneha P S
am 5 Apr. 2018
Bearbeitet: Peter H Charlton
am 6 Feb. 2025
I had a vector of size (1 x 65536). How can i check whether all the elements in that vector is an integer.
Akzeptierte Antwort
Von Duesenberg
am 5 Apr. 2018
check = [1 1.5];
logical(~rem(check,1))
1 Kommentar
Peter H Charlton
am 6 Feb. 2025
Bearbeitet: Peter H Charlton
am 6 Feb. 2025
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!