Character for "ENTER"

18 views (last 30 days)
Hg
Hg on 28 Feb 2017
Edited: Hg on 28 Feb 2017
I want to break a loop by pressing ENTER key. What character does ENTER key represent?
while (1)
if strcmp(get(gcf,'currentcharacter'),'??');
break;
end
end

Accepted Answer

Walter Roberson
Walter Roberson on 28 Feb 2017
Use CurrentKey 'Enter'
Otherwise, char(10)
  1 Comment
Hg
Hg on 28 Feb 2017
Edited: Hg on 28 Feb 2017
It seems like char(10) is for Windows. In my case, which is Windows on a Macbook, only char(13) works.

Sign in to comment.

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!