Split column in table based on character
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a table with a string column. Now i want to split this column in 3 seperate coluns.
In that column are strings like this:
["51∞ 13' 51,6""]
I want to create new columns like:
[51],[13], [51.6]
Anyone who can help me with this?
0 个评论
采纳的回答
Walter Roberson
2021-8-3
S = "51∞ 13' 51,6"""
str2double(regexp(regexprep(S, ',', '.'),'[\d.]+', 'match'))
Is it possible for + or - to appear? How is N vs S or E vs W denoted?
3 个评论
Walter Roberson
2021-8-3
S = [
"51∞ 14' 12,9"""
"51∞ 8' 40,2"""
"51∞ 16' 43,3"""
"51∞ 8' 40,3"""
]
cell2mat(cellfun(@str2double,regexp(regexprep(S, ',', '.'),'[\d.]+', 'match'), 'uniform', 0))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!