HOW TO CONVERT .m INTO .mat file

8 visualizaciones (últimos 30 días)
ASWANT KUMAR SHARMA
ASWANT KUMAR SHARMA el 21 de Nov. de 2017
Comentada: Jan el 10 de Nov. de 2018
HOW TO CONVERT .m INTO .mat file?

Respuesta aceptada

Jan
Jan el 21 de Nov. de 2017
You can't. Or you do not want to. At least you shouldn't.
M-files are scripts or functions. This means, that they contain code. But MAT-files contain data only. You cannot execute them.
Of course, there are some overlapping details: If the M file contains the definition of variables only:
% Your M-file
A = 1;
B = [256; 17];
Then you could store the contents of the created variables in a MAT file. Or if the MAT file contains an object, which triggers the execution of code, when it is initialized - this is the case for .fig files: They are MAT-files with a specific file extension. Opening such a file causes the figure to be constructed and the CreateFcn is called.
But apart from such exceptions, M and MAT files have different jobs and contain different kind of contents.
There I'm sure you want to do something else. Please explain, which problem you want to solve.
  3 comentarios
Stephen23
Stephen23 el 9 de Nov. de 2018
Editada: Stephen23 el 9 de Nov. de 2018
@Alejandro Turpin: How exactly did you do this? Tell us the exact steps that you used to save that data. There might be ways to get your data back (e.g. it might be as simple as changing the file extension), but unless you tell us what you did and/or upload the data files themselves, we have no idea how/what/why your data is encoded.
Jan
Jan el 10 de Nov. de 2018
@Alejandro Turpin: Please open a new thread to ask a new question. This is the section for comments to an answer to a different question.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by