I have a 12460x1 cell array with the content "<asdasd=!a1=-10.0" in each cell. I need the double values at the end and convert this to a matrix. Please note that there is always one more number in the cells and the values that I need could be positive or negative. Thanks in advace.

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 11 de Mayo de 2016
Editada: Andrei Bobrov el 11 de Mayo de 2016

1 voto

% z - your cell array.
x = regexp(z,'[\+\-]?\d+\.\d+$','match');
x = [x{:}]';
out = str2double(x);

1 comentario

GO
GO el 11 de Mayo de 2016
Thank you. I have found similar answers on the web but couldn't manage to do it properly. This solves the problem.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

GO
el 11 de Mayo de 2016

Comentada:

GO
el 11 de Mayo de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by