i am new to matlab .this is a text file and how to remove a lot of header files in dis text file and how to plot this data with respect to time versus height please inform me to understand my querstions
2 次查看(过去 30 天)
显示 更早的评论
i am new to matlab .this is a text file and how to remove a lot of header files in dis text file and how to plot this data with respect to time versus height please inform me to understand my questions and at at lost i want a plot x-axis showing time and y-axis axis with respect to data
2 个评论
dpb
2014-4-9
You mean multiple header lines in a text file? Are they a fixed number or variable?
Look at the optional argument 'headerlines' in
doc textread
doc textscan
for starters, if so...
As for plotting, it all depends on what the data are -- just a x and y or a surface or what.
采纳的回答
dpb
2014-4-26
SOTOO...
c=[]; % an empty array to collect data into
fmt=repmat('%f',1,4); % format string for the numeric data 4/record
fid=fopen('31oct97.txt','r'); % open the file, return file handle
while ~feof(fid) % begin loop until run out of data in file
c=[c;cell2mat(textscan(fid,fmt,187,'headerlines',24))]; % read a chunk/concat onto previous
end
NB: aircode, not tested but basic idea...salt to suit.
更多回答(1 个)
Image Analyst
2014-4-11
You forgot to attach your data file. I suggest you use the readtable() function with the 'HeaderLines' option. (Requires R2013b or later.)
9 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!