dat file

how do I read a dat file into matlab ? i have a dat file with 5 columns of numbers and i want to read column one and column five thank you in advance

3 Kommentare

Walter Roberson
Walter Roberson am 13 Mai 2011
duplicates http://www.mathworks.com/matlabcentral/answers/1632-dat-file
Jan
Jan am 13 Mai 2011
Is message duplication a new sport?
Walter Roberson
Walter Roberson am 13 Mai 2011
Matt and I did a clean-up sweep of known duplicate messages yesterday.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt Tearle
Matt Tearle am 19 Feb. 2011

0 Stimmen

I'm going to assume that you're talking about a text data file. In that case, use textscan:
fid = fopen('filename.dat');
Data = textscan(fid,'%f%*f%*f%*f%f');
fclose(fid);
You may need to specify other options to textscan, depending on your file formatting (header lines, delimiters, etc).
If the file is binary, then see Walter's answer to #1632

Kategorien

Mehr zu Data Import and Analysis finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 19 Feb. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by