The Nanoscale World

Incorrect data import to Matlab?

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 7 Replies | 3 Followers

Top 10 Contributor
72 Posts
Points 817
Polis Tyrol posted on Tue, Nov 26 2013 10:56 AM

Dear community,

I finally managed to import my (metric) AFM data to Matlab, which was quite a hard task. Qualitatively, everything works perfectly fine; the images look exactly the same in Matlab as the do in NanoScope Analysis. However, the quantitative values are entirely different. Where the height is in the range of -1 nm, Matlab gives -56, where it is +10 nm, Matlab gives 501. It seems, therefore, as if there was another unit used, although I set UnitType to NSMU.METRIC and scaleUnit is given as nm.

Actually, scaleUnit is always given as nm, for Adhesion data as well as for Modulus data. That strongly suggests that there is some error in the Matlab export function. Did you know about this bug, and how could one fix it?

Best regards, Dietmar

  • | Post Points: 12

All Replies

Top 10 Contributor
72 Posts
Points 817

I must correct myself: It seems the first issue happens only for flattened images! Doing exactly the same on an original image gives exactly the height data in nm you can see in NanoScope Analysis as well.

The second issue remains: All data channels have the scale "nm".

Dietmar

  • | Post Points: 12
Top 100 Contributor
8 Posts
Points 98

Dear Polis,

 

could you give a quick walk-through, how to import .pfc data using the NSMatlabUtilities.m file in Matlab?

 

So far I'm stuck at NSMU.Open('filename.pfc'); it tells me to localize the 'DataSourceDLL.dll' file and I have no idea where to find that library.

 

Your help is much appreciated,

 

best

Mortiz

  • | Post Points: 13
Top 10 Contributor
72 Posts
Points 817

Dear Moritz,

I never imported PFC-data, but only images so far. However, it seems your problem is very general and does not on which data type you want to import.

Generally, you need to install Microsoft Windows SDK 7.1 in order to use NSMatlabUtitities.m. If you didn't, you will get the error message 'Unable to load DataSourceDll.dll. Please install Microsoft Windows SDK 7.1 from http://www.microsoft.com/en-us/download/details.aspx?id=8279'. The file DataSourceDLL.dll is in the NanoScopeAnalysis folder, but in order to load it Windows SDK 7.1 is needed. Now, installing this is the hardest task, as this patch has a bug. The walkaround is given here: http://www.mathworks.com/matlabcentral/answers/101105 (at the bottom). While this helps a lot, I also needed to use this hint: http://www.mathworks.com/matlabcentral/answers/100144.

To summarize: (1.) Uninstall  Visual C++ 2010 Redistributable packages, both x64 and x86 versions. (2.) Download and install SDK 7.1 with unchecked  'Visual C++ Compilers' and 'Microsoft Visual C++ 2010'. (3.) Install the Microsoft patch http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4422. (4.) Reinstall the Visual C++ 2010 Redistributable packages. (5.) Start Matlab and run "mex -setup". NSMatlabUtilities worked for me after those steps.

Try that and comment if it worked as expected.

Regards, Dietmar

  • | Post Points: 10
Top 10 Contributor
72 Posts
Points 817
Answered (Not Verified) Polis Tyrol replied on Wed, Dec 11 2013 10:31 AM
Suggested by pfreumo

Dear Moritz,

Sorry for the late answer. I did answer earlier, but apparently something went wrong here in the forum, so once again:

I never imported PFC-data, but only images so far. However, it seems your problem is very general and does not on which data type you want to import.

Generally, you need to install Microsoft Windows SDK 7.1 in order to use NSMatlabUtitities.m. If you didn't, you will get the error message 'Unable to load DataSourceDll.dll. Please install Microsoft Windows SDK 7.1 from http://www.microsoft.com/en-us/download/details.aspx?id=8279'. The file DataSourceDLL.dll is in the NanoScopeAnalysis folder, but in order to load it Windows SDK 7.1 is needed. Now, installing this is the hardest task, as this patch has a bug. The walkaround is given here: http://www.mathworks.com/matlabcentral/answers/101105 (at the bottom). While this helps a lot, I also needed to use this hint: http://www.mathworks.com/matlabcentral/answers/100144.

To summarize: (1.) Uninstall  Visual C++ 2010 Redistributable packages, both x64 and x86 versions. (2.) Download and install SDK 7.1 with unchecked  'Visual C++ Compilers' and 'Microsoft Visual C++ 2010'. (3.) Install the Microsoft patch http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4422. (4.) Reinstall the Visual C++ 2010 Redistributable packages. (5.) Start Matlab and run "mex -setup". NSMatlabUtilities worked for me after those steps.

Try that and comment if it worked as expected.

Regards, Dietmar

  • | Post Points: 17
Top 100 Contributor
8 Posts
Points 98

Dear Dietmar,

thank for you for this valuable information! I performed this operation on two different machines. Somehow, after the installation, on one machine the SDK compiler and on the other machine the C++ compiler was available for Matlab using the mex - setup command. Both were able to open force volume data in the end. It's important to notice that the examples files in the NSMatlabUtilities folder couldn't be opened. However, trying to open any self generated .pcf files was successful.

Thank you for you help,

 

Best regards,

Moritz

  • | Post Points: 10
Top 100 Contributor
8 Posts
Points 98

Hi Dietmar,

 

I'd guess the 'nm' means nanometer in deflection (for Adhesion it would be the negative deflection) which you can transform in volts or Newtons by changing the input arguments for the DataUnit to NSMU.VOLTS or NSMU.FORCE respectively. (in case you performed NSMU = NSMatlabUtilities());

 

 

Best,

Moritz

  • | Post Points: 12
Top 10 Contributor
72 Posts
Points 817

Dear Moritz,

Glad to read that you could use my hints. I tried to open the example files myself as well now, and I came to the same result: It doesn't seem to work. I have no idea why.

Regarding the units: The variable is called scaleUnit, and for all image types (not only for Height images) it is "nm". I load images, not curves, so I expect the unit of the Adhesion image to be "nN", not "nm".
Also, the numbers match with the values you can see with NanoScope Analysis in nN, so a pixel that has 5.97 nN according to NanoScope Analysis, is loaded as 5.97 with NSMatlabUtilities; but the unit is given wrongly as "nm". That means that the option "NSMU.METRIC" is correct (NSMU.FORCE doesn't exist for images) and that there must be a bug in the definition of scaleUnit.

Regards, Dietmar

  • | Post Points: 10
Page 1 of 1 (8 items) | RSS
Copyright (c) 2011 Bruker Instruments