reading data from a file which include symbols.
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2015-5-27
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!