from numbers of 6 digits, how to remove the ones ending in 00000, 0000, 000 and 00

4 views (last 30 days)
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!

Accepted Answer

Image Analyst
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)
  1 Comment
Juan David Mateus
Juan David Mateus on 26 Apr 2020
Thank you very much, actually the ones ending in "0" i do need them haha, but i just changed 10 for a 100 and worked perfectly. Thanks!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!