Character for "ENTER"

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

0 votes

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

Products

Asked:

Hg
on 28 Feb 2017

Edited:

Hg
on 28 Feb 2017

Community Treasure Hunt

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

Start Hunting!