How to import AFM data to Matlab?
38 views (last 30 days)
Show older comments
Dear Matlab community!
I have the following problem: I'm measuring a surface with an AFM and analyzing it with Gwyddion. But since the graphic shows a slight bend, I would like to analyze the XYZ-data in Matlab first.
So my question is:
How can I import the XYZ data from Gwyddion to Matlab?
I hope someone can help me out!
Kind regards
4 Comments
Cris LaPierre
on 5 Aug 2020
For those of us who have never seen this file format before, could you perhaps upload a sample along with a description?
Answers (1)
Kiran Felix Robert
on 24 Aug 2020
Hi Hivanu,
There is no direct way to import AFM data from Gwyddion to MATLAB, but MATLAB has option to import csv files using the csvread function or the readmatrix function.
The data imported from a CSV file can be parsed into a matrix and can also be converted in to an image using the image function.
The data in Gwyddion file can be exported to either a CSV file or a .txt file with rows and column containing the required data, which can be parsed in MATLAB and can be saved as an image or used for analysis.
For example, assuming you export a grayscale image data from Gwiddon file which is saved as ‘GwiddonData.csv’, a csv file, then the following example shows one way to import it into MATLAB (Refer mat2gray for more information),
A = readmatrix('GwiddonData.csv');
% To Convert to Grayscale image
I = mat2gray(A);
imshow(I)
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!