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

 Réponse acceptée

Walter Roberson
Walter Roberson le 28 Fév 2017

0 votes

Use CurrentKey 'Enter'
Otherwise, char(10)

1 commentaire

Hg
Hg le 28 Fév 2017
Modifié(e) : Hg le 28 Fév 2017
It seems like char(10) is for Windows. In my case, which is Windows on a Macbook, only char(13) works.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by