read headerlines from a text file
显示 更早的评论
I am trying to read each parameters in the second headerline of the file:
This is my code:
File =['data3.txt'];
fid = fopen(File,'rt');
tmp = textscan(fid, repmat('%s',1,9), 1, 'delimiter','', 'headerlines',1);
meta = tmp{1};
fclose(fid);
The problem is that the string I got is a whole string with everything connected together. Is there a way I can get these parameters separately?
The spaces between two adjacent parameters could differ from file to file.
Thank you.
采纳的回答
更多回答(3 个)
Walter Roberson
2011-4-28
0 个投票
Leave out the 'delimiter',''
Fangjun Jiang
2011-4-28
0 个投票
What do you mean "that does not work". Type this:
[tmp{:}]'
类别
在 帮助中心 和 File Exchange 中查找有关 Historical Contests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!