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

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 Comments

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.
multiple header lines in a text file. and that too i have to plot in x,y and z dimensions.time in x-axis

Sign in to comment.

 Accepted Answer

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 Comment

thank u sir for ur help .how can i plot this in time series....and also in this data was also gone some what .now in this file timings are differeent how can i plot with exact timings on x-axis and height on y-axis and data u changing with respect to time in the same way time v,w also please give a program

Sign in to comment.

More Answers (1)

You forgot to attach your data file. I suggest you use the readtable() function with the 'HeaderLines' option. (Requires R2013b or later.)

9 Comments

ya i send data of text file .i want x axis with respect time and height on y axis and z-as u=(u u2 u3) changing z with respect to height and time
You have multiple data sets strung together
header
data
header
data
header
data
In that case you're going to have to scan down and parse lines. Use fopen, textscan, etc. Skip the header lines by searching for the first character of a line being numeric. Use isnumeric() for that. Then if it's a number, use textscan() to add it to an array, and then move to the next line. I'm pretty sure you can do it because it's not hard (I shouldn't need to do it for you after you look at the examples in the help), but if you have doubts or want me to look over your code, post it back here.
sorry sir, i am not getting your answer... can u give me some example or code relevant to my data.....
With regards,
Poshan.....
Look like you already have accepted an answer and got it working so it seems like I don't need to answer this anymore.
no sir, it is not working i had not got exact answer .i want all the above and at last i want a plot with the same timings in the text file on the x-axis and height on y-axis and data changing with respect to time
example on x-axis 17:49:53 at y-axis height 3.6 the u with some data and another header data on x-axis 17:49:53 at y-axis height 3.6 the u with some data
I assume you tried plot(x,y)??? And looked at xlim() and ylim()?
Well, attach your data file and the code that you have so far and perhaps someone will take a look at it.
okay.sir here i want load the time also,the code i applied is waste .give me a good program which is very useful and basic model.i want header and use data to plot using all parameters.please plot and send the program.i used contourf .but it is waste in giving time .that is exact time
in the above text file there is a time and date and u is changing with respect to time because it has has four headers sir .check it out

Sign in to comment.

Categories

Asked:

on 9 Apr 2014

Edited:

on 29 Apr 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!