MATLAB Answers


How do I import binary file data from a nt-mdt file?

Asked by Viral
on 17 Apr 2014
Latest activity Commented on by Star Strider
on 18 Apr 2014

I have used fid to identify the file, and fread to read it into a matrix but it spits out an empty matrix. It gave my file an fid=3.

The file is binary data that is in an x-y space, with each (x,y) having a 2 number value(intensity and wavenumber)


Need more info for sure to have any chance...the fid does indicate success in opening a file, but we need to see the actual code used and know what the actual data file structure is, if any, and the encoding of the data (integer, floating point, single- or double-precision if IEEE FP or some other representation, word length, endianness, etc., etc., etc., ...)

Is a "nt-mdt" some standardized format from some application; I've never heard of it (but that doesn't mean anything other than that I've not worked in whatever arena it is that generated the file)?


OK, a search shows it's a proprietary format but a search with "Matlab" didn't find a lot. Apparently there are a couple of commercial products but nothing really useful like a Matlab script or an actual file description showed up.

Did you search File Exchange just in case?

The code i used was:

fid = fopen('XX.mdt','r+')

it returned fid=3

I'll have to get back to you on the data file structure.

nt-mdt is a file format used specifically by a company that makes AFM and Raman systems, their own software can open it and so can an open source software called n-surf which is no longer maintained and was only in beta and cannot handle it.

It is described as a matlab script file which is why I believe there is some way to get that data out in matlab.

what do you mean by searching File Exchange?

Thanks for your help!

Log in to comment.

1 Answer

Answer by Star Strider
on 18 Apr 2014
Edited by Star Strider
on 18 Apr 2014

It’s an atomic-force microscopy file, according to a DuckDuckGo search. The only File Exchange contribution I can find is AFM Image Analysis. I don’t know if it also opens the data files.


Its from software that handles AFM and Raman Spectroscopy data, it was taken using Raman measurements though so it has spectra data and not AFM data.

 A commercial package called cytoSpec describes this file format as a matlab script file but it spits out an empty matrix so it might not be able to read it?

I did an Internet search and found this CytoSpec page for Save MATLAB. It also tells how to open the CytoSpec file.

It seems that load is the correct way to read the file, since it seems to be formatted as a MATLAB ‘.mat’ file.

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!