Is it possible to prevent matlab from saving an m-file on "run"?
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Matlab saves scripts whenever they are run. I understand that this is necessary for the function of a script. It has to be saved before it can run. Fine.
But I want matlab to ask me for confirmation before saving or force me to actively press the "save" button.
My girlfriend's cat just ran over the keyboard when I wasn't looking. I ran the script...and then spend some time tracking down what had gone wrong. In the end I had to restore to a backup from yesterday. But even without the cat factor, accidents happen. You want to search for something, press "ctrl+F" and accidently touched another button and there is an unintentional change in the script. I don't want anything commited to memory unless I actively, positively tell matlab to do it. A simple confirmation dialog. "Your file has changed. Do you want to save the changes?" like Eclipse does.
I have already turned of the "Save changes upon clicking away from file"-fea...No. I refuse to call this a "feature". Anyway, I turned it off.
Is there a way to also turn of the autosave on run?
0 comentarios
Respuestas (2)
Jan
el 13 de Mzo. de 2023
Of course changes can be taken back by Ctrl-Z easily, such that accidental input are no serious problem.
Even the attack of the cat would not been caught by a cofirmation dialog: If you are aware of the typing, Ctrl-Z will remove it. If you are not aware, you will confirm the dialog actively.
The reliable way to take back unintented changes is a File Version History. You find many software to do this and even Windows offers such a system. Then pressing Ctrl-S after intented changes does not need a lot of time.
A drawback: I've learned pressing Ctrl-S frequently the hard way. The editor of Matlab 5.3 crashed frequently and after 2 or 3 lines of coding I save subconsciously. Unfortunately this is not working in Matlab online, e.g. here in the forum, and so I frequently have to close the "Do you want to save this page as html file?" dialog.
Summary: An automatic history of saved files together with a frequent saving is more stable than a confirmation dialog.
2 comentarios
Jan
el 13 de Mzo. de 2023
An accidental deletion of a line will not impede that you confirm the dialog for saving the file, if you are not aware of the changes. Especially if you get aware of the changes days later, such a confirmation dialog will not help in any way. Therefore I'm convinced, that the method, you are asking for, will not solve your problem, while a version history will.
Ver también
Categorías
Más información sobre Entering Commands en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!