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

2 visualizaciones (últimos 30 días)
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!

Respuesta aceptada

Image Analyst
Image Analyst el 26 de Abr. de 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 comentario
Juan David Mateus
Juan David Mateus el 26 de Abr. de 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!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by