Thread Subject: Questions on GUIs (Graphical User Interface)

Subject: Questions on GUIs (Graphical User Interface)

From: stat

Date: 12 Jun, 2009 16:24:03

Message: 1 of 11

Hello, thank you for taking from your time to read this message :
I have a few questions about GUIs. I think ActiveX components are very useful and I am use to do UserForms (GUIs) in VBA, this allows me to use all those activeX controls, which I don't know if they are available in Matlab.
 
Here are my questions :
1. Can I use all those activeX controls available in VBA to do a GUI in Matlab ?
2. If I decide to do a user form in VBA, can I in any kind use it from matlab, which for me means calling functions and access the "control properties" (VBA denomination, basically access for instance the value entered in a textbox etc...)
3. Is there a good tutorial or book to create GUI in matlab which would be in english or in french exclusively ?

Thank you very much

Subject: Questions on GUIs (Graphical User Interface)

From: John

Date: 12 Jun, 2009 18:28:01

Message: 2 of 11

Do you know that Matlab has its own GUI Design Environment (GUIDE) tool Type guide on the matlab prompt to create/edit GUIs. It has drag and drop uicontrols with property browser to set/view properties and define Callback routines. Check the documentation for Guide to get more help.

You can also add activex components.

"stat " <statquant@gmail.com> wrote in message <h0tvf3$e8s$1@fred.mathworks.com>...
> Hello, thank you for taking from your time to read this message :
> I have a few questions about GUIs. I think ActiveX components are very useful and I am use to do UserForms (GUIs) in VBA, this allows me to use all those activeX controls, which I don't know if they are available in Matlab.
>
> Here are my questions :
> 1. Can I use all those activeX controls available in VBA to do a GUI in Matlab ?
> 2. If I decide to do a user form in VBA, can I in any kind use it from matlab, which for me means calling functions and access the "control properties" (VBA denomination, basically access for instance the value entered in a textbox etc...)
> 3. Is there a good tutorial or book to create GUI in matlab which would be in english or in french exclusively ?
>
> Thank you very much

Subject: Questions on GUIs (Graphical User Interface)

From: stat

Date: 12 Jun, 2009 22:57:01

Message: 3 of 11

Hello,
yes I know but I find it (the matlab tool) very unfriendly, compare to vba user form designing, there are just 10 controles available + activeX that you can't even see during design... very poor design indeed.

What about using a VBA gui with matlab is possible?

Subject: Questions on GUIs (Graphical User Interface)

From: Mark Hayworth

Date: 13 Jun, 2009 01:03:01

Message: 4 of 11

"stat " <statquant@gmail.com> wrote in message <h0umft$q50$1@fred.mathworks.com>...
> Hello,
> yes I know but I find it (the matlab tool) very unfriendly, compare to vba user form designing, there are just 10 controles available + activeX that you can't even see during design... very poor design indeed.
>
> What about using a VBA gui with matlab is possible?

stat,
Yes GUIDE does pale in comparison to Visual Studio and they have been working on a new version for a long time and I don't think there's any ETA. We know it's bad and they know it's bad. An alternative is to develop your front end in VB and then just make calls to MATLAB like it is a library. You need the NE .net Builder product to do this.

Regarding #1, yes you can add third party or Microsoft COM objects to your figure. Just pic the button on the toolbar that says "ActiveX control" and then select the control that you want. I've only done it once a long time ago so I don't remember the details after that.

Regarding your #3: For tutorials, go to the File Exchange and type "video tutorial gui" into the search field and you will find many, many tutorials by Doug Hull on GUI basics and programming.

Alternatively, you may like to use MAGIC, a basic GUI template I wrote that has most of the basics that you need for processing data files. It's a good one to start with if you're just learning. It's link is:
http://www.mathworks.com/matlabcentral/fileexchange/24224

ALternatively, you can find about 4 dozen other gui examples/tutorials here:
http://www.mathworks.com/matlabcentral/fileexchange/?term=tag%3A%22gui+example%22

Subject: Questions on GUIs (Graphical User Interface)

From: stat

Date: 13 Jun, 2009 10:19:01

Message: 5 of 11

Hello Mark, and thank you for answering
I definitly think I am going to design my GUI with VBA, here are my reasoning :

1. first GUIDE seems to be "obsolete" (at least poor)
2. your code seems awesome, but as I understand it, it has only basic controls, and as a matter of fact I am looking for quite funky activeX controls...

This leads me to 2 other questions (sorry :?))

1. Do you advise me to build my GUI in VB.NET rather then in VBA ? I don't really know what difference it could be but as I understand it the communication between the User form and Matlab would be in .NET rather than COM which should be "better"
2. Do you know how to get funky controls for building GUIs ? as a matter of fact I look for 2 :
http://www.monsterup.com/image.php?url=upload/1244888254396.jpg
http://www.monsterup.com/image.php?url=upload/1244888254444.jpg

Cheers

Subject: Questions on GUIs (Graphical User Interface)

From: Mark Hayworth

Date: 13 Jun, 2009 14:35:03

Message: 6 of 11

stat:
1. I'd advise vb.net. You can get the express edition of vb.net (visual studio 2008) for free. Isn't VBA just like a macro language for applications - basically VBA is the VB programming language built into Excel and Word for creating applications that run in those programs, rather than being a full blown language and development environment itself? I'm not a real expert on the difference between COM objects, ActiveX controls, OCX's, and .Net assemblies - you mihgt ask in the microsoft.?public.?dotnet.?languages.?vb forum for that. I think .Net assemblies are different than the other 3. VS.Net can use any of them. If you use vs.net and just call MATLAB as kind of a background number crunching engine, and use their .net builder product to connect the two, then you can use whatever you want. If you don't use vs.net and use GUIDE, then I think (not sure on this) that you can only use
the older style ActiveX, COM, and OCX controls, and you can't use the more modern .Net Assemblies (of which I haven't found a lot around anyway). MATLAB's Builder NE product costs extra money and can be found here:
http://www.mathworks.com/access/helpdesk/help/toolbox/dotnetbuilder/index.html?/access/helpdesk/help/toolbox/dotnetbuilder/


2. If you get the non-free version of Visual Studio.net 2008 you can develop your own custom activeX controls. Otherwise you install 3rd party OCX's, COM objects, or ActiveX controls such as Quicktime and whatever else you showed. Once they're installed and registered, they'll show up in the pick list of controls that you can put onto your figure.
Good luck,
Mark

Subject: Questions on GUIs (Graphical User Interface)

From: Stephen Morris

Date: 18 Jun, 2009 11:02:02

Message: 7 of 11

"Mark Hayworth" <hayworth@none.com> wrote in message <h10den$5gs$1@fred.mathworks.com>...
> stat:
> 1. I'd advise vb.net. You can get the express edition of vb.net (visual studio 2008) for free.

Hi Mark,

I just came to this discussion a few days late, but it touches on something I've spent a lot of time looking at lately. Maybe you have some wisdom to impart. GUIDE has been driving me nuts lately, and I'd love to design a new GUI for my main application using Windows Forms or even WPF.

The trouble is, I have a lot of data visualisation to do (graphs, contour maps, live video images etc.), which MATLAB does very well. There doesn't seem to be a way, however, of integrating MATLAB axes into a Windows Form, so if I went down that route I would need to find (and learn) an alternative third-party package and rebuild all the data visualisation graphics. I'm not up for that right now.

If you know of a way to put Matlab axes into a Windows Form, then please share it. Otherwise, GUIDE despite its failings seems to be the best compromise for GUIs which need to combine controls, ActiveXs and data visualisation.

Stephen.

Subject: Questions on GUIs (Graphical User Interface)

From: Mark Hayworth

Date: 18 Jun, 2009 13:53:02

Message: 8 of 11

Stephen Morris
That's a very good question, but honestly, I don't know. I do have the NE builder but haven't played around with it yet. MATLAB does have some pretty fancy graphing capabilities but I don't know if you can create the fancy graph in MATLAB and then pull it over and show it in your VB or C# interface. You can pull over the data from MATLAB, and then use third party graphing controls for Visual Studio to plot it. Most of these are just as capable, or more so, than what MATLAB has.
Mark

Subject: Questions on GUIs (Graphical User Interface)

From: Atrish Mukherjee

Date: 19 Jun, 2009 02:28:01

Message: 9 of 11

"Stephen Morris" <stephen@morris.net> wrote in message <h1d6ra$629$1@fred.mathworks.com>...
> "Mark Hayworth" <hayworth@none.com> wrote in message <h10den$5gs$1@fred.mathworks.com>...
> > stat:
> > 1. I'd advise vb.net. You can get the express edition of vb.net (visual studio 2008) for free.
>
> Hi Mark,
>
> I just came to this discussion a few days late, but it touches on something I've spent a lot of time looking at lately. Maybe you have some wisdom to impart. GUIDE has been driving me nuts lately, and I'd love to design a new GUI for my main application using Windows Forms or even WPF.
>
> The trouble is, I have a lot of data visualisation to do (graphs, contour maps, live video images etc.), which MATLAB does very well. There doesn't seem to be a way, however, of integrating MATLAB axes into a Windows Form, so if I went down that route I would need to find (and learn) an alternative third-party package and rebuild all the data visualisation graphics. I'm not up for that right now.
>
> If you know of a way to put Matlab axes into a Windows Form, then please share it. Otherwise, GUIDE despite its failings seems to be the best compromise for GUIs which need to combine controls, ActiveXs and data visualisation.
>
> Stephen.

Hi
I have done something like what you want to do. I have made my GUI in VB.NET and then use matlab for all the computation and plotting. If this is what you want i can help you. Following are the steps that you need to follow.
 1>First write all your functions for computation and plotting
2> then use matlab com builder for generating "com" files (i.e .dll) corresponding to your functions.
use "comtool" command to get access to combuilder gui window.
3> Register your com components
you can register them by the registration tool generated by combuilder or alternatively you can use "regsvr32 (dll name)" in command prompt to register your dlls.
4> then goto VB.NET activex controll, then chose Com components nad select your dll from the list
5>Now follow the methods for using com component in VB, and you will be able to call your matlab functions just as another function in VB. To run the program You just need Matlab runtime library of the version of matlab that you have used to generate the com files.

This technique helped me a 2years before. Hope this will help you too.!

Subject: Questions on GUIs (Graphical User Interface)

From: Stephen Morris

Date: 19 Jun, 2009 15:23:01

Message: 10 of 11

"Atrish Mukherjee" <atrish@mathworks.com> wrote in message <h1et3h$fhg$1@fred.mathworks.com>...
> "Stephen Morris" <stephen@morris.net> wrote in message <h1d6ra$629$1@fred.mathworks.com>...
> > "Mark Hayworth" <hayworth@none.com> wrote in message <h10den$5gs$1@fred.mathworks.com>...
.
.
>
> This technique helped me a 2years before. Hope this will help you too.!

Atrish,

Thank you for your advice; there's one thing I'd like to check, namely, does this method allow the MATLAB figures to be embedded within the Windows Form, or do they just appear as 'pop-ups'. I read somewhere else (see http://mathforum.org/kb/thread.jspa?forumID=80&threadID=1668465&messageID=6029870#6029870) that figures generated from MATLAB shared libraries appeared as pop-ups and (judging by the lack of replies to the post quoted) couldn't be properly embedded. Has that situation changed?

Besides, if the .NET builder is required to do this, then I'd balk at spending a further $4000+ for that when I've already shelled out $5000+ for the compiler. Again, if that's the case then I'll probably grit my teeth and stick with GUIDE for now.

Stephen.

Subject: Questions on GUIs (Graphical User Interface)

From: Atrish Mukherjee

Date: 19 Jun, 2009 16:29:02

Message: 11 of 11

"Stephen Morris" <stephen@morris.net> wrote in message <h1gagl$4n0$1@fred.mathworks.com>...
> "Atrish Mukherjee" <atrish@mathworks.com> wrote in message <h1et3h$fhg$1@fred.mathworks.com>...
> > "Stephen Morris" <stephen@morris.net> wrote in message <h1d6ra$629$1@fred.mathworks.com>...
> > > "Mark Hayworth" <hayworth@none.com> wrote in message <h10den$5gs$1@fred.mathworks.com>...
> .
> .
> >
> > This technique helped me a 2years before. Hope this will help you too.!
>
> Atrish,
>
> Thank you for your advice; there's one thing I'd like to check, namely, does this method allow the MATLAB figures to be embedded within the Windows Form, or do they just appear as 'pop-ups'. I read somewhere else (see http://mathforum.org/kb/thread.jspa?forumID=80&threadID=1668465&messageID=6029870#6029870) that figures generated from MATLAB shared libraries appeared as pop-ups and (judging by the lack of replies to the post quoted) couldn't be properly embedded. Has that situation changed?
>
> Besides, if the .NET builder is required to do this, then I'd balk at spending a further $4000+ for that when I've already shelled out $5000+ for the compiler. Again, if that's the case then I'll probably grit my teeth and stick with GUIDE for now.
>
> Stephen.
You dont need .NET builder. Matlab has its own combuilder. Just check whether you have it installed on your pc or not by typing the command "comtool" in matlab command window.
And the com file generated are simple '.dll' files. You can even use these com files with visual basic 6 which did not use .NET.

another thing i have to mention here, to my knowledge it is not possible to embed the matlab figures in your visual basic gui form, but there might be some way to do that, I will try it.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui stat 12 Jun, 2009 12:29:03
com stat 12 Jun, 2009 12:29:03
activex stat 12 Jun, 2009 12:29:03
vba stat 12 Jun, 2009 12:29:03
rssFeed for this Thread

Contact us at files@mathworks.com