MATLAB Answers

How to make the cursor go automatically to command window after hitting run (F5) in MATLAB R2016a?

61 views (last 30 days)
Hari on 30 Mar 2016
Commented: David Cox on 16 Jun 2020
When there is a user defined input, MATLAB's cursor would automatically go to the command window after hitting run and takes the input.
For some strange reason, in this version of MATLAB (i.e R2016a), I have to manually click on command window (or use CTRL+0) to shift MATLAB's focus.
I tried resetting MATLAB preferences but still doesn't work. I am not sure if other users had experienced a similar problem.
Any help on fixing this is greatly appreciated. Thanks!

Sign in to comment.

Accepted Answer

Daniel on 17 Nov 2016
I found the solution. Use the command "commandwindow" before you run the "input" command. This will shift the focus (from whever it was) to the command window before asking for an input.
%%Insert in your script the following
input('Press ENTER to continue');
This has worked for me in Matlab R2016a

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!