I have inherited a pile of Matlab scripts that manually build a GUI using calls to uicontrol, uimenu, etc. Over the years we have needed to remove and add elements to the GUI and since all the positions are specified manually in the scripts, the layout hasn't really changed to accommodate the missing elements so it is really starting to look like a pile of trash.
Is there a way to automatically convert my matlab scripted gui into something I can use with guide? I would rather not have to start over...
GUIs generated with GUIDE are not much better than manually scripted ones (if not worse in my opinion in terms of maintainability).
The sad truth is that there are no builtin layout managers in MATLAB (there are user-contributed ones on FEX like border layout, gridbag layout and others). If you are refactoring the code, please consider using some sort of GUI layout manager.
To answer your question, afaik there is no automatic tool for such a conversion.
To be exact, MATLAB has some undocumented layout managers: uiflowcontainer
and uigridcontainer
. See this article by Yair Altman
Well, there is no automatic conversion utility but you dont need to create everything from scratch with GUIDE.
Execute your GUI so that it shows up and save the figure window as a fig file. This file then can be edited with guide. However this needs manual adjustments in your code. Especially if you need access to handles and I am also not sure about the callback functions.
However, as Amro already pointed out, GUIDE is not a perfect solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With