convert String (cell) table

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!

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 7월 21일

0 개 추천

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)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

질문:

2011년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by