convert String (cell) table

1 visualización (últimos 30 días)
Yousef
Yousef el 21 de Jul. de 2011
Hi guys,
I try to convert a sting cell array in an integer array. My string array contains basically integers but some values have an additional A/B/C sufix (e.g. 12A or 14C). So I want to replace the A/B/C with .1/.2/.3 to have only double values. I would be grateful for any help!?!
I thought using ismember to find the A/B/C and then I need some kind of string parser!

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 21 de Jul. de 2011
Would this work for you?
Str={'12','12A','12B','12C','13'};
Str=strrep(Str,'A','.1');
Str=strrep(Str,'B','.2');
Str=strrep(Str,'C','.3');
Date=str2double(Str)
  1 comentario
Yousef
Yousef el 21 de Jul. de 2011
Thanks thats it!!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by