How to take a .dat file and be able to load it as a .mat file in MATLAB

6 views (last 30 days)
I have a .dat file that I've been trying to load in MATLAB. I cannot figure it out.
  4 Comments
Walter Roberson
Walter Roberson on 26 Apr 2020
Sorry, I cannot download the file to test as I do not have a login for there. I also cannot search those pages to locate context of what the file is even for to try to get some idea of what it might contain.
.dat can be any kind of data file. There is absolutely no standard for .dat : most applications that have their own private data file format calls call them .dat . There is nothing we can do for you without either context or a copy of the file (and even a copy of the file is not certain to be sufficient.)

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 26 Apr 2020
Why do you think the .data file in in proprietary MAT file format, just with a different extension? If it is, this should work:
s = load('yourFileName.data');
If it's not a mat file, it may not work. Please attach the .dat file if you need more help. In the meantime, try to read it in with importdata() - which seems to be one of the most flexible functions. Or try dlmread(), csvread(), fileread(), textscan(), fgetl(), etc.

Tags

Community Treasure Hunt

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

Start Hunting!