Is it possible for the Command Window to be active when plotting figures and waiting for user input in MATLAB?

5 views (last 30 days)
Is it possible for the Command Window to be active when plotting figures and waiting for user input in MATLAB?
When I am plotting figures, they usually cover the Command Window. Therefore, if I have an INPUT command in the script for user interaction, it is blocked by the figure. Is there a suitable way of calling the Command Window to the foreground when user input is requested?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Apr 2012
This can be done by calling the UIMENUFCN function. For example:
h=uicontrol('style','push','call','uimenufcn(gcf,''WindowCommandWindow'')')
Create a figure and execute the above command. Then bring the figure window in front of the Command Window and press the pushbutton. The Command Window will be brought in front of the figure window.
NOTE: The UIMENUFCN function is not documented and we cannot provide technical details regarding UIMENUFCN.
An alternative workaround would be dock the figure windows so that they do not cover the command window. This can be set as a default using the following command:
set(0,'defaultfigurewindowstyle','docked');
Upon execution of this command on the MATLAB command prompt, subsequent figure windows will be docked.
One can also bring focus to the command line with a shortcut key which is by default mapped to the following key combination.
CTRL + 0
PLEASE NOTE: This shortcut does not work when the focus is on the figure, but works when the focus is on other components in MATLAB like the help documentation or the editor.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!