How can I read a .DAT file into a variable?

Currently, I collect data in .DAT format, use an older software package to convert it to .CSV, and read it into MATLAB using:
FILE = csvread('Data.csv', 1, 0, [1, 0, 401, 4]); % 400 rows of numerical data & 4 columns (no text)
I've tried reading in a .DAT file using an example I found in the MATLAB documentation:
csvwrite('csvlist.dat',m)
However, the results end up being a wild assortment of characters.

댓글 수: 4

csvwrite('csvlist.dat',m)
?? csvwrite is for writing files, not reading files ?? Are you trying to create a .dat file instead of reading one?
writetable(array2table(m), 'csvlist.dat', 'writevariablenames', false, 'filetype','text')
Keith Grey
Keith Grey 2020년 5월 19일
I tried implementing what was shown in the link (above) and still ended up with an assortment of incoherent symbols.
I'm trying to take a .DAT file from my analyzer and convert it to a Double.
Maybe converting to a .CSV is unneccessary.
csvwrite('csvlist.dat',m)
That would not read a .dat file and write out a corresponding .csv file !
There is no standardized .dat format: '.dat' is used as a generic "data" indication, and can be in any format, including proprietary binary formats (and possibly even encrypted.)
If you know which device created the .dat file then we might be able to track down documentation as to the format of the file.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Standard File Formats에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2020년 5월 19일

댓글:

2020년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by