accidentally changing built-in code from checking it by clicking on the error line
Show older comments
whenever an error occurs in using a built-in function, it is possible to visualize the underline code by clicking on (line ###). If, while checking, part of the code is changed accidentally (e.g. a character of the existing code is deleted, or a new character is added), does Matlab "remember" this change? Is such a change irreversible? Thank you
1 Comment
dpb
on 15 Mar 2020
If you make a change in a file in the editor and save that file, then yes, that file has been changed permanently.
Whether it is reversible depends, but in general the answer is, unfortunately, "No" unless a copy of the file has been made which a user is unlikely to have done.
It's a double-edged sword of the feature that so much of MATLAB is written in MATLAB m-file code; those files are no different than user-created ones. I've often wondered why the install doesn't mark those files as readonly so such mistakes can't happen so easily altho that makes distribution and updates more complicated for TMW.
If it has happened about the only way to recover would be to restore a copy of the function from a distribution but TMW doesn't make that an easy thing to do, either.
I think it is a weakness...
What you need to do is to be VERY careful to not CTRL-S in a system file in the editor but to cancel out and to not automatically reply yes if prompted to save the file if closing the window brings up the prompt. IS A GOOD REASON TO NOT CHECK THE AUTOMATIC "Save changes upon clicking away from a file." You can get some help if also do not check "Automatically delete backup files when the Editor closes" as then there should be a backup copy of the original.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!