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

2 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Image Analyst
Image Analyst il 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 Commento
Juan David Mateus
Juan David Mateus il 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!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Simulink in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by