HOW TO CONVERT .m INTO .mat file
8 次查看(过去 30 天)
显示 更早的评论
HOW TO CONVERT .m INTO .mat file?
0 个评论
采纳的回答
Jan
2017-11-21
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 个评论
Stephen23
2018-11-9
编辑:Stephen23
2018-11-9
@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
2018-11-10
@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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!