-1

How can I create a GUI in Matlab?

I know about GUIDE, but I am not satisfied with the amount of customization that it provides. What other options I have ?

Andrey Rubshtein
  • 20,795
  • 11
  • 69
  • 104
Atish
  • 174
  • 3
  • 9

1 Answers1

2

I am a big proponent of using the Matlab-Java interface for GUI's in Matlab. It's a little more cumbersome, but definitely worth the trouble if it's a reasonably featured GUI. It's just like programming in Java, but using the m-script interface. To create a Java GUI you'll need to use the Matlab built-in function javaObjectEDT and pass it the class from which you want an instantiation.

frame = javaObjectEDT('javax.swing.JFrame');

The javaObjectEDT call is recommended by the Mathworks to ensure garbage collection, etc. When you set a callback to a Matlab function handle, you'll need to follow:

hjObj = handle(jObj, 'CallbackProperties');
set(hjObj,'MouseClickedCallback',{@treeClicked,fig},'ToolTipText','Tip: use Alt-Click to edit plotting functions');

Which is explained here.

There are a lot of details, but down at the core it's m-script based Java that integrates really well with Matlab.

macduff
  • 4,655
  • 18
  • 29