Matlab command window minimize - matlab

I am running a GUI in MATLAB. I want whenever my GUI gets opened MATLAB command window should be minimized?
I have tried with WindowAPI but it is not working. Please give some suggestions on how to do this.

You can do this using Matlab's Java support, thereby manipulating the (undocumented) Java objects that make up the Matlab IDE. As far as I know, the Command Window is always embedded in the main Matlab Desktop Window, so here's the code to minimize that.
Get a reference to the Java object that implements the Matlab Desktop:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance();
Get a reference to the window (Java Frame) that contains the Desktop:
mf = desktop.getMainFrame();
Minimize it:
mf.setMinimized(true);
This approach works across platforms.
See http://undocumentedmatlab.com/ for more information on the undocumented internals of Matlab.

Related

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.

Command Window Output with MATLAB GUI

I am pretty new to MATLAB GUI. I've attempted to teach it to myself the last few weeks so I can understand and improve some code that is being developed where I work. GUI is still a fairly new concept to me.
I am wondering: I need the command window to output the mean of a set of data according to a function that is called by pressing a button on the GUI. Where would I include this code and how should I go about it?
Thanks
You can debug the code by using 'disp' or 'fprintf' functions. Notice that converts your content to compatible with the function.

Control MATLAB IDE window size from within MATLAB

Is there any way to resize the MATLAB IDE using MATLAB code? I want to be able to maximize the window or have it take up half the screen from a script. This is on a Windows machine.
I can probably call out to an external program like AutoHotkey to do it, but am wondering if there is a native way.
You can do this using a handle to the desktop:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
desktop.getMainFrame.setSize(1200, 1000)
desktop.getMainFrame.setLocation(0, 0)

How to start Matlab profiler

I switched to Matlab 2012b (from 2011a), but fail to find out how to start the profiler gui in the new matlab gui.
The GUI option is still there, in the editor tab:
You will be able to specify input parameters once the function has crashed ;)
AFAIK, this should still work:
profile viewer
while we're at it, these tweaks should still work, too:
profile -memory on
setpref('profiler', 'showJitLines', true);
I don't have the opportunity to check, but you mean to say that R2012 doesn't have the little button on the top anymore?

Non Maximized matlab GUI figure

Is there a way to create a GUI which starts as a maximized windows?
I've tried to add set(gcf,'Units','normalized','Position',[0,0,1,1]); at the end of my gui's mygui_OpeningFcn() function but the GUI is not maximized properly (see printscreen).
Setting the GUI properties at GUIDE to Units-'normalized' and Position-[0,0,1,1] didn't help either.
I've also tried to use the Matlab File Exchange maximize function by adding maximize(handle.figure1); at the end of my gui's mygui_OpeningFcn() but it doesn't work either (same visual result - a GUI which is not entirely maximized).
Is there a way to make the Matlab GUI appear as a maximized figure when I launch it?
Why am I getting this strange visual behavior of the GUI?
If you are on a Windows machine, I suggest you use the WindowAPI submission from FEX. It directly calls Windows API functions (using a MEX file), thus allowing far more advanced control of figures than just minimize and maximize:
hFig = figure('Menubar','none');
WindowAPI(hFig,'Maximize')