HOW TO CONVERT .m INTO .mat file
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
HOW TO CONVERT .m INTO .mat file?
0 commentaires
Réponse acceptée
Jan
le 21 Nov 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 commentaires
Stephen23
le 9 Nov 2018
Modifié(e) : Stephen23
le 9 Nov 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
le 10 Nov 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!