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!