How to import AFM data to Matlab?

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 commentaires

KSSV
KSSV le 5 Août 2020
You need to specify about your data? How the data is? Is it in a file? Is so how the file is.
Hivanu I
Hivanu I le 5 Août 2020
Yes, it's a gwyddion file. So when I'm on gwyddion, I can see the image of the surface and I'd like to export the "Z-Axis foward" values.
Cris LaPierre
Cris LaPierre le 5 Août 2020
For those of us who have never seen this file format before, could you perhaps upload a sample along with a description?
Hivanu I
Hivanu I le 7 Août 2020
I will try! In Gwyddion the image in the backround is the surface of my sample. When I click on Info-->Data Browser, the window in the front shows up and I can choose between the image channels. The other headings just as Graphen (Graphs), Sprektren (Spectra) etc are empty. There are options of exporting the mean values but I need all the original values of the Z-Axis forward channel.
Please excuse my English, I'm trying my best.

Connectez-vous pour commenter.

Réponses (1)

Kiran Felix Robert
Kiran Felix Robert le 24 Août 2020

0 votes

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)

1 commentaire

Hi Hivanu,
We have collected togther several MATLAB scripts from various authors to open various AFM image file formats. We have packaged these in a GUI but the MATLAB functions for file opening can be downloaded here:
(go to the functions tab and see the scripts for functions for different file formats, open_nanoscope, open_gwychannel, open_ibw, open_JPK...)
or here:
The open_gwychannel function will open files saved in gwyddion. If you download the script and then run:
[im, meta] = open_gwychannel(filename)
Replacing 'filename' with the filename eg:
[im, meta] = open_gwychannel('Testdata.gwy')

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Import and Analysis dans Centre d'aide et File Exchange

Question posée :

le 5 Août 2020

Commenté :

le 8 Oct 2024

Community Treasure Hunt

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

Start Hunting!

Translated by