How to generate .m file from GUIDE GUI?
14 次查看(过去 30 天)
显示 更早的评论
Hi,
I have created a GUIDE GUI in Matlab and wrote thousands of lines of code. I was moving a lot of objects in the GUIDE window, like 20 edit objects and some other stuff with the arrows on the keyboard. Everything got immensely slow, and Matlab didn't respond. I chose to terminate the Matlab process, and as I did, it asked me if I want to save the gui and also if I want to save the .m file. I clicked yes, and restarted Matlab.
After this, I had to face the most horrible experience I've ever had with any software: the GUIDE GUI (I mean the .fig file) is okay, but the .m file was replaced by a completely empty 0KB file .
I am absolutely desperate, I lost a week's worth of work with that .m file gone (I know, I should have made a backup copy from time to time). Does anyone have an idea if Matlab maybe has some temp folder or something like that, any way to retrieve the lost file?
I suspect this is impossible, in that case I need to regenerate the .m file to at least contain all the callbacks of the GUIDE GUI (the objects in the .fig file). Now if I click 'Save As...' it just saves the .fig file, and generates a new empty .m file. I know I can't get my lost code back, but I should be able to at least generate a .m file with all the callbacks (like when you save the gui for the first time).
Any help or suggestion is very much appreciated. Thank you, Laszlo
Edit1: Following Iain's suggestion I searched for the .asv file, unfortunately there was none on my computer. Therefore, the second part of the question is more important now, so that I don't have to recreate the whole GUI at least. Thank you.
Edit2: The Properties --> Previous versions section of the folder in Windows 7 did not have any backup unfortunately.
2 个评论
Alexei
2014-11-21
Guys, what's the answer to this? I also want to regenerate all the callbacks because my GUI script file was somehow corrupted. How does one regenerate all the callbacks?
Jan
2014-11-22
@Alexei: The answer to this question is simple:
Recover the file from your backup. If you do not have a backup, the work is lost.
For your question see your own thread: It is not clear to me what "generate callbacks" means.
回答(3 个)
Vishal Rane
2013-11-22
If in windows 7, Check the Properties > Previous Versions for the concerned folder. By any luck if you have Windows Backups enabled or a restore point created in last couple of days, you will see an old version of the folder.
Alternatively use a retrival software like recuva. If file has been accidently deleted, you should be able to retrieve it.
Edwin Fonkwe
2017-9-25
It's been a long time now since the first question. For what it's worth, I ran into a similar problem (Matlab 2017) on guide; to solve the issue, I created a new guide, copied the first guide panels (copying the panel includes all its children components) to the second one. BEFORE saving the new guide, I had to manually modify the tag names of the all components as they had defaulted to the generic naming format. Then I saved the work, and voila! A new .m file populated with all the callbacks was generated. Good luck!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!