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

2 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by