I have a char data. I want to extract first column from this char data.
11 views (last 30 days)
Show older comments
%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 Comments
Accepted Answer
Evan
on 9 Jul 2013
Edited: Evan
on 9 Jul 2013
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 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!