Read text file containing string and numeric data
1 次查看(过去 30 天)
显示 更早的评论
I would like read the following text file that has column values with string and numeric data. Problem is the numeric column is mixed with 'N/A'. After reading, I like to use data from column 8 and 11. I'm using R2010b.
0 个评论
采纳的回答
Matt Fig
2012-11-15
fid = fopen('Test.txt');
C = textscan(fid,repmat('%s',1,19),'Headerlines',1)
fclose(fid)
HeadDiam = str2double(C{8});
TYPE = C{11};
Note that when using STR2DOUBLE, those N/As are converted to NaNs
更多回答(1 个)
Abirami M
2020-3-11
Use this Url and how to read and preprocess this kind of text data in matlab.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!