from numbers of 6 digits, how to remove the ones ending in 00000, 0000, 000 and 00
2 views (last 30 days)
Show older comments
Juan David Mateus
on 26 Apr 2020
Commented: Juan David Mateus
on 26 Apr 2020
i have a column of more than a thousand numbers of 6 digits, imagine something like the following:
100000
105000
126577
148400...
I need to eliminate the rows which number correspond to a number ending in 00000, 0000, 000 and 00, i was advice to use math operations or to convert the numbers to string, but i have not been able to achive it, i guess it´s a quite silly operation, but i have no idea.
Thanks!
0 Comments
Accepted Answer
Image Analyst
on 26 Apr 2020
I don't know why you need string operations. Simply find out what numbers are not multiples of 10 and extract only those:
v = [...
100000
2
31
105000
12340
123400
123456
1030
126577
148400]
% Find out which rows are not a multiple of 10.
validRows = mod(v, 10) ~= 0
% Extract only the good rows.
v = v(validRows)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!