Character for "ENTER"

20 次查看(过去 30 天)
Hg
Hg 2017-2-28
编辑: Hg 2017-2-28
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

采纳的回答

Walter Roberson
Walter Roberson 2017-2-28
Use CurrentKey 'Enter'
Otherwise, char(10)
  1 个评论
Hg
Hg 2017-2-28
编辑:Hg 2017-2-28
It seems like char(10) is for Windows. In my case, which is Windows on a Macbook, only char(13) works.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by