Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Matlab GUI into a guide GUI

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...

like image 452
mjr Avatar asked Feb 17 '23 17:02

mjr


2 Answers

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

like image 64
Amro Avatar answered Feb 24 '23 04:02

Amro


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.

like image 20
Andreas H. Avatar answered Feb 24 '23 04:02

Andreas H.