Running Multiple Instances Of The Same GUI

Hello, I have couple questions pertaining to GUIs.
For a bit of background I created a simple GUI that connects to a camera using a MEX file. The idea behind the GUI is that you can open as many GUIs as you want and assign each GUI to a specific camera.
So far everything works great for taking single images, but for acquiring more video like functionality(only 1Hz is needed)I run into my first problem and possible solution.
When this video like functionality is activated, the GUI is set into a loop that simply squires a image and sends it to the GUI axes. This works great for one GUI, but when you go to do anything on another GUI you cannot since they are all run off the same instance of MatLab. Is their a easy way to boot up another instance of MatLab and have it open another camera GUI automatically via a command from a already running instance of MatLab?
If you can't boot it straight from another instance of MatLab, is their at least a way to boot up MatLab without having the main window visible?
For my second question, when I am acquiring an image their is text indicator that is suppose to light up to tell the user the camera is currently acquiring an image, but it doesn't light up right away like it should. Basically the acquire image function goes like this.
function acquireImage(source, eventdata,h)
set(h.info,'Visibility','on');
acquireImage();
"..Some Image processing functions"
set(h.info,'Visibility','off');
The visibility of my indicator doesn't actually turn on till after the acquireImage function is complete, why is that?
Thanks so much for your help! In return I will try and see if their is any other questions here that I could possibly answer.

 Accepted Answer

Is the gui in guide?
gui_Singleton = 1; %turn me off to allow multiple instance!
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @foo_OpeningFcn, ...
'gui_OutputFcn', @foo_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);

3 Comments

I created the GUI programmatically.
Please correct me if i'm wrong, but this looks as though it would simply allow me to open multiple GUIs. My problem is that I can't run a active for or while statement in each GUI at the same time since they were both called from the same MatLab instance.
Thanks though.
Ahh. But your could use timers instead of while loops. You can have multiple timers all running at once independently and happily.
Strange I didn't stumble upon this before. I had just been using pauses.
Thanks for your help!

Sign in to comment.

More Answers (1)

For your second question: after your call
set(h.info,'Visibility','on');
add a
drawnow()
call.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!