user1338219
user1338219

Reputation: 35

load a file with varing number of columns in matlab

I need to load a file with a not fixed number of columns in matlab, skipping the first 2 lines and the last one.

Good gRace! Old Maple Actually Chews Slate
5296
350GLU      N 3475 -11.747  -2.990  -0.626
350GLU      H 3476 -11.792  -2.965  -0.541
350GLU     CA 3477 -11.605  -3.015  -0.625
..........................................
1441LEU      C14823 -12.241  -9.504  -2.663
1441LEU      O14824 -12.316  -9.586  -2.714
14.31797  21.41320   9.79756

does anyone know how to do that? both textscan and fscanf looks like they need the number of columns specified in advance.

Thanks

Upvotes: 1

Views: 1222

Answers (1)

Malife
Malife

Reputation: 303

You can use the dlmread command. So you could do something like

data = dlmread('myDataFile.txt', '\t', [startRow startCol endRow endCol]);

Hope this helps!

Upvotes: 1

Related Questions