- Right click on the .dat file and select Import Data. This opens an Import Tool which helps you import the data interactively with different options. More details can be found here: https://www.mathworks.com/help/matlab/import_export/import-data-interactively.html
- Another way is to use fopen to open the file and get a handle to the file (aka FileID). Once the file is opened, functions like fgetl, fscanf, fread, etc. can be used to read from it, ensuring that appropriate formatting is specified.
- Here is a related MATLAB Answers post with code to read a mock .dat file using the textscan function, used to read formatted data from a text file and store it in a cell array: https://www.mathworks.com/matlabcentral/answers/1697030-dat-file-to-a-readable-file-for-an-array-in-matlab
How to read Brimrose NIR spectral data
2 views (last 30 days)
Show older comments
Hi, I am trying to read NIR data from Brimrose. File format is .dat, Pleae see the attached zip. If Notepad is used, all sorts of characters appear. I tired various matlab commads, fopen, load etc. no luck. Thank you for your help.
0 Comments
Answers (1)
Govind KM
on 7 Nov 2024 at 9:28
The content and structure of a .dat file depend on the application that created it. It is not tied to a specific type of data or format, which means it can be a text file, binary file, or any other data format. Documentation regarding the specific format of the Brimrose NIR data would be required to read the .dat file.
Once the format is known, some ways to read the file are:
Hope this is helpful!
0 Comments
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!