Copying a matlab gui to a different directory
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I'm having a whole host of errors stemming from a simple (in my mind) problem.
I have a complicated GUI that I wrote. I want to modify it to import a different type of data, but do this in a copy of the GUI in a different directory.
I have tried:
1) Copying both the .fig and .m file and renaming all "GUI_V1" to "GUI_V2" in the .m file... Doesn't work.
2) Opening GUI_V1 within GUIDE, save as -> GUI_V2... Doesn't work and I get a slew of different errors. It sometimes generates a new .m file with the appropriate title but the .fig file doesn't save.
Has anyone gotten past this? Thanks!
3 件のコメント
Adam Danz
2019 年 9 月 10 日
I listed some troubleshooting steps below. After you're done the renaming, if you still have a problem please attach the m file and fig file.
回答 (1 件)
Adam Danz
2019 年 9 月 9 日
編集済み: Adam Danz
2019 年 9 月 13 日
This is among the common problems with GUIs produced in GUIDE. Many volunteers in this forum are not shy about their disdain for GUIDE GUIs. Custom made GUIs created with uicontrol() are much better.
How to correctly rename a GUIDE GUI
To rename a GUIDE gui you have to open the GUI in GUIDE, go to file > saveas, and enter a new filename. That creates a new fig and m file under the new GUI name. Manually changing the m file name and figure name is not enough and will break the GUI as you are experiencing.
Fixing your improperly renamed GUIDE GUI
Fixing this may not be easy. Start by backing up a copy of what you've got because your efforts to fix it may corrupt it further.
Then rename the original m file and figure to their original names (case sensitive). Then open the mfile and search for any instances of the 'wrong' GUI name and change it back to the original GUI name. The GUI name may appear in the following areas, and in additional places unique to your GUI.
- In the first line at the main function name
- toward the top of the m file where gui_State structure is formed. You'll see function handles with the GUI name
- In the OpeningFcn function
- In the OutputFcn function
- Potentially other areas unique to your GUI
Then try to open the GUI in GUIDE.
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!