My MATLAB code has been replaced by a function of the file name. How to recover the code?

68 次查看(过去 30 天)
  3 个评论
Image Analyst
Image Analyst 2024-8-19,21:37
编辑:Image Analyst 2024-8-19,21:38
I don't even know what that means. What is "a function of the file name"? It looks like you have a function VsDistance in a file called VsDistance.m and in there are some comments, but they're followed by code that has nothing to do with the function description. Did you mistakenly paste over the code with your code and save it? If so try control-z a bunch of times (as long as you haven't exited MATLAB yet) to undo your changes.
Or see if there is a VsDistance.asv file in the same directory. That would be an automatically made backup file.
DGM
DGM 2024-8-20,17:37
编辑:DGM 2024-8-20,17:51
When you save a figure as 'mfig' instead of 'fig', saveas() creates both a .fig file and a .m file which will open the .fig file of the same name.
So it's possible a person could have a user-defined function or script VsDistance.m, create a figure, and then save the figure as VsDistance.fig, and unwittingly overwrite their working code -- or possibly just shadow it.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by