*why* easter egg in MATLAB

8 vues (au cours des 30 derniers jours)
Rainer
Rainer le 1 Fév 2013
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?

Réponse acceptée

Jonathan Epperl
Jonathan Epperl le 1 Fév 2013
S = evalc('why')
  1 commentaire
Rainer
Rainer le 1 Fév 2013
Perfect! Thanks.

Connectez-vous pour commenter.

Plus de réponses (2)

Shashank Prasanna
Shashank Prasanna le 1 Fév 2013
or
>> edit why
change
function why(n)
to
function a = why(n)

Daniell Algar
Daniell Algar le 1 Fév 2013
Modifié(e) : Daniell Algar le 1 Fév 2013
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.

Catégories

En savoir plus sur Holidays / Seasons dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by