reading data from a file which include symbols.
2 views (last 30 days)
Show older comments
anton fernando
on 27 May 2015
Commented: anton fernando
on 28 May 2015
I need to read the first column of the file attached and the last 3 digits of each line as a column. Appreciate any help.
0 Comments
Accepted Answer
Walter Roberson
on 27 May 2015
t = regexp(fileread('Dst.txt'), '(\r)?\n', 'split');
firstcol = regexp(t, '^\S+', 'match');
last3 = regexp(t, '...$', 'match');
first_last = [firstcol(:), last3(:)];
first_last{1,1}, first_last{1,2} is the pair for the first line
More Answers (0)
See Also
Categories
Find more on Data Import and Analysis 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!