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!