Borrar filtros
Borrar filtros

Extrac Part of a cell array

1 visualización (últimos 30 días)
Daniel Boateng
Daniel Boateng el 28 de Mayo de 2019
Respondida: Stephen23 el 28 de Mayo de 2019
I have a cell array like a = {'danny_820','richard_320','Tom_500','Fred_120'}. Please how do i extract the numbers so that i will be left with
{820,320,500,120}
Thanks

Respuestas (1)

Stephen23
Stephen23 el 28 de Mayo de 2019
>> a = {'danny_820','richard_320','Tom_500','Fred_120'};
>> str2double(regexp(a,'\d+$','once','match'))
ans =
820 320 500 120

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by