How to read .txt file with numbers and texts?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello. I have a .txt file including numbers and texts separated by tabs. I have tried dlmread, csvread, etc but not still able to get the file content as a matrix. I do not know what is wrong. I appreciate your help.
file=strcat('C:\my_files\','1,3','.txt');
SCRIPTfile = char(file);
dataSCRIPT=dlmread(SCRIPTfile);
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 4월 30일
Use readtable(); it will figure everything out automatically.
Or you could make a small modification to the code I posted at https://www.mathworks.com/matlabcentral/answers/285186-importing-data-without-knowing-number-of-columns#comment_368710
댓글 수: 14
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Data Preparation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!