How to pause my first MATLAB GUI while the second one is in front - matlab

I want to find a solution that pauses the GUI that I created using App Designer in MATLAB.
I mean exactly like uigetfile(), that when you run it you can’t reach the main GUI windows until you close the uigetfile() window.
I need a way to pause my first GUI in the background while my second GUI is in front.

You should set the WindowStyle property of the second figure window to 'modal'. See the documentation for this property.

Related

How to run a gui from another gui tab in matlab?

I am unsure of how to call up and run a separate GUI from my main GUI homepage. I am able to open it using uiopen(' ') but I am trying to get it to automatically run it if possible. I've created all of the GUI pages and I have set up the callbacks but I cant get it to work.
every GUI has a guifile.m, so you can just call the name of the 2nd GUI.
for example, assuming you have two GUIs, gui1.{m,fig} and gui2.{m,fig}. In the OnButtonClick even in your gui1.m, you just call gui2 to open up the gui2 window.

MATLAB GUI Stuck After Save Tool from Guide

I have been working on an gui developed using the GUIDE in Matlab. The current gui, I mean the general figure window contains all types of sliders, buttons, editboxes, etc...
After awhile, I added a toolbar to my gui which included the Save tool. I have not changed any specifications regarding the save tool. I used the one already in GUIDE toolbar editor.
After clicking it, my gui program is stuck at that very instance I pressed the save tool and I cannot do anything else with it. It also opens in the same situation even after restarting the PC. I do not get any errors.
I would appreciate any help. How to restore functionality to my gui?
Unfortunately the "Save" tool's default is not "Save As" with a prompt it is just the normal "save" which immediately overwrites. The tool saved your current figure (or GUI). Meaning it overwrote the fig file of your GUI with the current state.
So when you pressed "save" uicontrol visibility, values, slider positions, edit box text etc. all was written into the FIG file. So the next time you launch it is all still in there.
To Fix it you will probably have to edit in GUIDE and try to clear / reset everything to your desired initial state.

Matlab GUI always on foreground

I created two GUI in Matlab: gui1 and gui3.
I don't know why but gui3 is always in the foreground.
If, when gui3 is running, I try to click on Matlab or something else, I hear the classic 'beep' of Windows and gui3 is always stay in the foreground.
Why?
Here's a gif to better understand what's happening.
I searched in the Inspector but didn't find anything to do to my case. How can I fix it?
I don't write here my code because I don't know what to write, but if you need it, I will.
Thank you
This will happen if the GUI has the WindowStyle property set to modal. modal means it will always be on top and will block the rest of the Matlab GUI. Try changing the WindowStyle to normal.

Add new window to OpeningFcn of MATLAB GUI goes to back of main window when running

I have a Main_window in MATLAB guide. I want open a New_window when I run Main_window, So I add this code in OpeningFcn of Main_window :
New_window();
When I run Main_window, New_window goes to back of Main_window. I want it in front of Main_window after running.
Any help?
This is happening because you are calling New_window before Main_window has finished executing.
Ideas:
You could simply call Main from new instead. I'm guessing that you already tried this and it doesn't work for your application
If you want the user to do something with new_window, then proceed to main_window, you could enable uiwait in the new_window opening fcn to keep it in focus until the user closes it.
Create a script that contains two lines
Main_window;
New_window;
Running that script will start both programs in sequence, and New_window will be on top.
Ultimately, if you want to maximize control, you should write your own gui instead of using GUIDE.

How to run the code without the GUI

I have a rather long perltk code in my hand and I would like to run the simulation in a batch mode (without using the GUI). e.g. I would like to run it with script like "myprog.pl -b" in stead of setting all the parameters in the GUI and click buttons.
My current method is using a separated XML file for config and the function "after" which means the GUI will pop-out and start the simulation then exit after sometime. It is now working, but I have a question: is there a better way solve this problem? Is that possible to have the GUI shown in the background (so we wont see it) in stead of pop-out?
Change the program so it is accessible from both a graphical and command-line interface. Factor out its real functionality into subroutines.
Run the program in an xvfb so that no window is shown on the main display.
Configure the window manager to always start instances of this program minimised and/or with a 0x0 size.