*why* easter egg in MATLAB

10 ビュー (過去 30 日間)
Rainer
Rainer 2013 年 2 月 1 日
Typing "why" into the command prompt yields a random answer. My question is: WHen I execute "why", how can I store the output string as a variable?

採用された回答

Jonathan Epperl
Jonathan Epperl 2013 年 2 月 1 日
S = evalc('why')
  1 件のコメント
Rainer
Rainer 2013 年 2 月 1 日
Perfect! Thanks.

サインインしてコメントする。

その他の回答 (2 件)

Shashank Prasanna
Shashank Prasanna 2013 年 2 月 1 日
or
>> edit why
change
function why(n)
to
function a = why(n)

Daniell Algar
Daniell Algar 2013 年 2 月 1 日
編集済み: Daniell Algar 2013 年 2 月 1 日
This is quite the ugly solution but. Open a script, paste
diary('whyText.txt')
for i= 1: 10
why
end
diary off
and you'll store the answers in the current folder/whyText.txt.

カテゴリ

Help Center および File ExchangeHolidays / Seasons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by