How to create a .mat file with variables

8 visualizaciones (últimos 30 días)
Palguna Gopireddy
Palguna Gopireddy el 21 de Feb. de 2022
Comentada: Palguna Gopireddy el 22 de Feb. de 2022
I have an image with 39 point scatterers like this
It is loaded from a .mat file named 'Fighter.mat'. The content of Fighter.mat mat is showing like this.
I want to know how to crate a .mat file and that too how to assign variables to the content like 'Xc','Yc' to it as shown in the figure .

Respuesta aceptada

Jan
Jan el 21 de Feb. de 2022
See: help save
Xc = 1:10;
Yc = rand(1, 10);
save('YourFile.mat', 'Xc', 'Yc')

Más respuestas (1)

Matt J
Matt J el 21 de Feb. de 2022
You can use matfile() to alter the contens of a .mat file directly, but it might be easier just to load Fighter.mat, make whatever changes you want in the Matlab workspace, and then resave to a new file.

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by