How to run the code without the GUI - perl

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.

Related

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

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.

MATLAB Simulink Model Configuration Parameters: Empty Window

I am currently working with Simulink and out of the sudden, I am unable to change the Model Configuration Parameters.
Whether I try to open the window via RightClick->Model Configuration Parameters or via Ctrl+E, in both cases, a blank white window opens.
This problem persists after a reboot and opening/closing MATLAB. Furthermore, it is the case for any model (whether old, new, untouched, example...) on my computer. Yesterday I searched for 45min for possible solutions but could not find any.
Is there some graphics cache or can you think of another way, how I could get the dialog back? A photo is attached:
Screenshot: Configuration Parameters window stays blank
Thanks a lot in advance!
This problem happens in Academic version on Simulink. I have not seen it in Original software.
A solution for your problem can be :
1) clear cache of Simulink by typeing the following command in command window :
rehash toolboxcache
2) reset menu and toolbar of Simulink by the following command :
sl_refresh_customizations
Then close MATLAB by exit command.

Bring Matlab uigetfile window to front of all other programs?

I'm calling a script from another program (Vicon Nexus 2.3). This other program will launch Matlab, then run the script.
The first thing the script does is it calls uigetfile(). However since the Nexus program has the Windows focus, the uigetfile() window appears behind everything. Is there any way to bring it to the front without using the mouse?
I've tried:
shg
uistack()
But I think the issue here is windows focus, not uistack. Anyone out there know if this is possible?
What you need to do is bring Matlab to front before opening uigetfile dialogue. You can do that e.g. by calling commandwindow:
commandwindow();
uigetfile();
Tested by starting Matlab from command line and overlaying some other windows on top once it is open, but before the code after pause is executed:
matlab -r "pause(3); commandwindow(); uigetfile();"

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.

Why does file have to be saved prior to running?

In MATLAB, why does the file have to be saved prior to running ?
I often try quick snippets of code, which I could also easily run also on the Command Window line by line. So, why when I run them through the editor, I have to save them first ?
Can this behaviour be changed, maybe ?
You can use cell mode in the editor placing %% before your code. See also Cell menu in the editor. Once you create cells, you can run them one by one pressing Ctrl-Enter. You don't need to save the file. However you cannot use editor's debugging features (breakpoints, etc).
Video tutorial
my guess would be that when you run your program, the matlab interpreter run it from the disk and not from the IDE buffer. so if you don't save the file it wouldn't run the correct code.