.DAT file

11 views (last 30 days)
William Du Chene
William Du Chene on 7 Nov 2011
I have data that is in a .DAT format. The file contains header information about the test that was run and contains text and numbers. The data located below the header information and has two lines of text (data name and units below), then the numerical data is located below the units. The data is in columns and can vary in length depending on how long the data was recorded for. I would like to be able to separate out the header information from the data. I'm a newbee to MATLAB, so I'm grasping at how this can be done. I would normally use excel, however, there are at times more than 30k lines of data and excel cannot plot all the data easily. Thanks ! Sincerely, Bill D.
  1 Comment
Walter Roberson
Walter Roberson on 21 Nov 2011
There is no standard format for .DAT Files; as a file extension, it can mean anything. You will have to provide us with basic information about the file format including whether the numeric data is represented as text.

Sign in to comment.

Answers (3)

Fangjun Jiang
Fangjun Jiang on 7 Nov 2011
Provide a snip of your example .dat file will be helpful. Check out the function textscan(), it can skip header lines. For some files, you might be able to use importdata() and uiimport(). Once you went through one example, uiimport() can generate the necessary code to do the import in automation.

William Du Chene
William Du Chene on 18 Nov 2011
This is the header information:
numSysManualLogType=1
timSysManualLog=300
vsSysProjectFolder=11-01041
numSysTestRun=300
vsSysTestComment=pilot injection injector delivery 650 -1.5
vsSysDataFile=11-01041_300
vsSysTestStartDate=10-27-2011
I'm having problems pasting the data in, but in a nut shell, the top of the column is the variable name, below that is the units and finally, below that is the data. Hope this helps.. Thanks for the help !
Sincerely,
Bill D.
  4 Comments
Fangjun Jiang
Fangjun Jiang on 21 Nov 2011
Is the number of lines fixed for the header section? How many columns are there for the data section? These are the basic question need to be clarified before anyone can help you.
Walter Roberson
Walter Roberson on 21 Nov 2011
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

Sign in to comment.


William Du Chene
William Du Chene on 22 Nov 2011
The header data in my mind has two parts: First is the data in column A rows 1-58. Second is the main body of the data starting in Column F row 59. (Sorry for speaking excel here). The main body of the data concsists of two lines of header information, the name and units. The data follows the headers. The column data names will vary depending on how many variables are selected in the pre test set up. The header information in A1-58 can vary as well, but is a fixed in our out put for now. What I would like to do in read all of the data into Matlab, but if this is too complicated, I would settle for just the main body of data.
Sincerely, Bill D.

Tags

Community Treasure Hunt

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

Start Hunting!