3

I am researching building a full UI for a piece of Matlab numerical code. I can of course port the code to another platform and build the UI in the usual suspects (Qt, Java, etc), but it would be much preferable to communicate with the scientists on the project to retain the code in Matlab.

What is the recommended approach here? I found some old (ca 2007) tutorial on building UI for Matlab, but nothing really good. There is also "MATLAB Advanced GUI Development" (Scott T. Smith), which is very on-topic but dates back all the way to 2006.

So what's the modern approach to building a UI for Matlab? What are the recommended references?

The UI aims to provide data visualization as 2D plots, not in strict realtime but under a second, and some minor interactive capabilities (e.g selecting options or click-selecting coordinates).

0xF2
  • 314
  • 3
  • 17
  • 2
    You could improve this question immensely by going into more detail about the sort of UI you hope to create. Simple form, bolt-on to existing Matlab UI, interactive visualization, etc... – Shog9 Oct 10 '11 at 21:18
  • What I was after was building a UI, *in Matlab*, that would be leave the numerical code as it's own stand-alone entity. And, since UI tools for Matlab have changed over time, figuring out what was currently in use, as documentation was out of date and referring to obsolete solutions. Been there, done that. Disappointed to see the response of 5 moderators pouncing on a new member, so much for Community building folks. Really appreciative of @Mikhail's helpful answer. That is how a Community works. – 0xF2 Dec 22 '14 at 17:11
  • @Shog9: good point! Edited to include those details. – 0xF2 Dec 22 '14 at 17:14

2 Answers2

7

GUIDE is very limited and a pain when used in 'larger' projects. Therefore I suggest to use MATLAB's seamless integration of Java. Undocumented Matlab is an excellent source for Java/MATLAB integration.

Making use of the 'undocumented' areas of MATLAB, a 'dockable' window can be integrated into MATLAB's IDE. Just execute the following code as m-file.

import javax.swing.*;

dt=com.mathworks.mlservices.MatlabDesktopServices.getDesktop;
panel = JPanel();
dt.addClient(panel, 'MyPanel');
zellus
  • 9,617
  • 5
  • 39
  • 56
  • Really useful tip. Did not need to do this in the end, but Undocumented Matlab solved a host of other problems for me, Thanks! – 0xF2 Dec 22 '14 at 17:16
4

The topic is very broad, it depends also on your time constrains and general knowledge of GUI frameworks like Java Swing. I think there is no one best answer but these links could still help:

Software engineering and patterns in Matlab GUI application?

How can I program a GUI in MATLAB?

how to implement the idea of mvc design in matlab gui's

Software engineering and patterns in Matlab GUI application?

Is the MATLAB gui creator GUIDE as awful as I think? Is there an alternative?

https://stackoverflow.com/questions/4380737/what-books-will-you-recommend-to-read-about-writing-a-gui-programms-in-matlab

Breaking from for loop in MATLAB GUI

MATLAB programming best practices

Community
  • 1
  • 1
Mikhail Poda
  • 5,742
  • 3
  • 39
  • 52
  • 5
    Are you suggesting people vote/flag to close as duplicate/not a real question instead of answering? – random Oct 10 '11 at 21:15
  • @random & friends: Your critique is unfair! Try to answer "How might I build a full UI for a piece of MATLAB numerical code?" yourself! Or write a book with this title. And accept SO rules instead of blaming me http://blog.stackoverflow.com/2011/01/real-questions-have-answers/. Finally, FYI, I did not vote to close it. But you could vote to reopen it! – Mikhail Poda Oct 11 '11 at 05:57
  • @mikhail, zellus, thank you for your comments! – 0xF2 Nov 22 '11 at 07:59