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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

製品

タグ

質問済み:

Hg
2017 年 2 月 28 日

編集済み:

Hg
2017 年 2 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by