Check if the number has any digits after the decimal points matlab
Ältere Kommentare anzeigen
I have a vector which is a mixture of floating point and whole numbers. I am trying to identify the whole numbers and divide them by 100. Assuming the vector is 'v'
v = [9.3, 6.8, 7, 4.1, 3]
I want to identify 7 and 3. How do I go about this, most of the algorithms I came across on mathworks do not work for a vector or they only return the number of digits after the decimal and if its a whole number i get error.
Akzeptierte Antwort
Weitere Antworten (1)
Ron Aditya
am 15 Sep. 2014
0 Stimmen
1 Kommentar
Star Strider
am 15 Sep. 2014
My pleasure!
I was under the impression your vector is a numeric array. I didn’t realise it was a string array or cell array of strings. Both Roger’s and my approaches use ‘logical indexing’.
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!