*why* easter egg in MATLAB

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일

1 개 추천

S = evalc('why')

추가 답변 (2개)

Shashank Prasanna
Shashank Prasanna 2013년 2월 1일

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일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Holidays / Seasons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by