Is there a command that will refocus the active window back to the command window in Matlab's GUI?

I am trying to use a script (script A) that prints a letter to the active window every 2 seconds to test the timing of one of my scripts (script B). I have just noticed that when I run script B on a second monitor, so I can see the Psychtoolbox window and the Matlab window, script A finally works when I click on the command window after the Psychtoolbox window flips.
It won't be a perfect fix but if I can find a command (or a functions I can write to mimic this) it should solve the problem for now. I have quizzed the Psychtoolbox boards, as well, in case I can't find an answer here.
I have also found a bunch of questions on this board that are similar to the one I am asking, but they all regard focus shifts from a figure created by MatLab. I am going to try the options given in those answers but as I am not dealing with a figure I believe it won't fix the problem.

1 Comment

Please mention, what "prints a letter to the active window" exactly means. How do you "run a script on a 2nd monitor"?! Monitors cannot run scripts.What ist "the Matlab window"? What does "the Psychtoolbox window flips" mean?
I do not understand, what you want to achieve, what are you doing currently and which problem you have.

Sign in to comment.

Answers (1)

commandwindow() % no inputs
% Will make the command window the active window.
% That is, if you start typing, the text will be
% entered in the command window.
But I agree with Jan that your goal is unclear.

Products

Release

R2019a

Asked:

on 30 Jul 2019

Edited:

on 30 Jul 2019

Community Treasure Hunt

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

Start Hunting!