I have a char data. I want to extract first column from this char data.
2 次查看(过去 30 天)
显示 更早的评论
%for example,
out1 =
p.11 109 820 109
p.12 503 159 117
p.13 234 207 151
p.14 139 134 215
Name Size Bytes Class Attributes
out1 1x188 376 char global
% what I want is that extract the first column if we think as a matrix. (p.11,p.12,p.13,p.14) %also, the first column would include only numbers so I need the codes which works both number and number-character mixed.
thanks in advance
0 个评论
采纳的回答
Evan
2013-7-9
编辑:Evan
2013-7-9
If out1 is your string:
pgs = char(regexp(out1,'p\.\d+','match'));
Note that this requires out1 be a 1xn array, which it looks like it is. The reason for the char command is that regexp returns a cell array of matching strings. If a cell array works for you, just remove the char function.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!