Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

How do I change what Matlab recognizes as the column header in a .ASC file?

$
0
0
BACKGROUND:
I ran several trials of an experiment and I have .ASC files containing all the data from the trials. Each file contains 23 rows of text above the data, with 21 rows of irrelevant text (it's just headers describing the trial), then a row of actual column headers (row 22), then (right above the data, i.e. row 23) a row of units for the data. Also, there are 109 columns in the .ASC file.

When I use:
DataFile = importdata('TestData.ASC')

Matlab returns:
DataFile=
data: [9009x109 double] (there is quite a lot of data)
textdata: {23x109 cell}
colheaders: {1x109 cell}

My problem is the fact that Matlab recognizes the first row of text above the data as the colheaders. As I said above, the first row above the data in the .ASC file is the units row.

For a program I am writing, I have matlab look at the .ASC file, find a specific column header, import the data under it, and manipulate it. The problem is, the ACTUAL column header I need matlab to recognize is the 22nd row of the textdata. NOT the 23rd row.

Can someone please help me? At first I went into the .ASC file and deleted the unit row manually, but since I have 400 files, I can't possibly do this for all of them.

I either need a way for Matlab to recognize the 22nd row or I need to figure out how to write a matlab script to delete the 23rd row for me and save the modified file.

Can someone please help me? I haven't been able to find either solution on the forum.

Viewing all articles
Browse latest Browse all 19628

Trending Articles