Firstly, it depends on the structure of the file. I think, it is an

ASCII file.

You can use various commands. Please look at the Matlab help for the

commands above.

1) d=load('file.dat');

???if there are only numbers in the file.

2) x=dlmread('file.dat',[1 0 20 3]);

???if you will read only the first 4 columns

???and the rows until rows 21 without the

???first row.

3) [z1 z2]=textread('file.dat','%s %s');

???if there are two columns. letters are

???allowed in the file.

4) the most generalized possibility you

???have with fopen/fgetl commands, which

???allows you to read formatted files.

?

fid=fopen('zurich');

i=0;

clear x

while 1

??i=i+1;

??s=fgetl(fid);

??if ~ischar(s), break, end

??x(i,1)=str2num(s(1:4));

??x(i,2:13)=str2num(reshape(s(5:end),7,12)')';

end

fclose(fid)

In (1)-(3) the data in the file must be delimitered, whereas in (4)

the data must be presented in a fixed structure. All above are

examples for special numbers of columns/ rows and formatted datas,

resp., which you have to modify to your data structure. However, with

this commands you will find enough help in Matlab.

Norbert

> how can i read a file .dat with matlab?

> Thanks

> Isabella

1. converting .mat files into .dat files

Hello all,

I want to convert some .mat files into .dat files. Does anyone know

any Matlab functions that can do this?

Thanks in advance.

Renius

3. To convert a .wav file to .dat file in MATLAB

4. Networking.......what's the big hold up?

5. plotting data from *.dat or *.raw files??

6. No sound after installing ethernet adapter

8. Anarchie Pro F3.0 available

9. conversion to *.m a *.dat file

10. license.dat file for individual MAC license

11. Wanted: Export Matlab data to "Famos" *.dat file

12. Saving 2 variables in .DAT File

2 post • Page:**1** of **1**