How to extract numeric data from a textfile?
3 views (last 30 days)
Show older comments
Clayton Ross
on 25 Sep 2017
Commented: Clayton Ross
on 25 Sep 2017
Hi all, is there a method in which I would be able to extract x and y coordinate data from a textfile, when the x and y values are divided by a '/'?
I need to extract and then plot the coordinate data.
The textfile should be attached above. Any help would be greatly appreciated. Thanks :)
0 Comments
Accepted Answer
Walter Roberson
on 25 Sep 2017
Edited: Walter Roberson
on 25 Sep 2017
S = fileread('P01-GroupM(1).txt');
XYstrs = regexp(S, '^X/Ycoords \(in):\s*(?<X>\S+)\s*/\s*(?<Y>\S+)', 'names', 'lineanchors', 'dotexceptnewline');
X = str2double({XYstrs.X});
Y = str2double({XYstrs.Y});
plot(X, Y)
axis equal
More Answers (0)
See Also
Categories
Find more on Weather and Atmospheric Science 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!