how to write a character from a string?
1 次查看(过去 30 天)
显示 更早的评论
Hi I didn't use commands for strings in matlab so i have a word like 'displacement22' and i want to write '22' from this string, so what would i do?
0 个评论
回答(3 个)
Image Analyst
2013-2-2
s = 'displacement22' % Your string.
theNumber = sscanf(s, 'displacement%d') % Extract the number.
0 个评论
Azzi Abdelmalek
2013-2-2
编辑:Azzi Abdelmalek
2013-2-2
s='displacement22' ;
out=s(regexp(s ,'[0-9]'))
%or
out=s(regexp(s ,'\d'))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String Parsing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!