how to split a string at apostrophe using strsplit

5 次查看(过去 30 天)
I have a string '40°50'24', I want to separate the string at '&#176' and apostrophe between 50 and 24. Therefore, I am expecting 40, 50 and 24 in separate cells. But I am not able to separate the apostrophe using strsplit. Is there a way to do it?


Akira Agata
Akira Agata 2018-3-2
You should repeat apostrophe to represent apostrophe in MATLAB, like:
>> S='I''m fine!'
S =
'I'm fine!'
So, regarding your question, please try the following:
>> strsplit(str,{'°',''''})
ans =
1×3 cell array
{'40'} {'50'} {'24'}

更多回答(0 个)


Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息



Community Treasure Hunt

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

Start Hunting!

Translated by