Spy Easter egg take 2

Three years ago, I posted a short post about Matlab’s built-in Easter egg in the spy function. Apparently, when running spy with no input arguments, it uses an undocumented default built-in sparse matrix that generates the white spy in the famous Spy vs. Spy comics series:

>> spy;

Matlab spy Easter egg

As was recently reported by Aurélien, the default built-in sparse matrix has changed in R2011a (not R2011b as in the original report):

Matlab spy Easter egg

If you ask me, the previous (white spy) image had more relevance to the spy function… I assume the new image was not chosen arbitrarily – if anyone has some insight as to why this image was chosen and its relevance to spy, please post a comment.

Addendum: The original spy image can still be generated using the following code snippet:

c = [';@3EA4:aei7]ced.CFHE;4\T>*Y>,dL0,HOQQMJLJE9PX[[Q.ZF.\JTCA1dd'
i = double(c(:)-32);
j = cumsum(diff([0; i])<=0) + 1;
S = sparse(i,j,1)';

Happy Easter / Passover everybody!

Categories: Low risk of breaking in future versions, Stock Matlab function, Undocumented feature

Tags: , , ,

Bookmark and SharePrint Print

6 Responses to Spy Easter egg take 2

  1. Daniel Shub says:

    If you trust the comment at MATLAB answers: http://www.mathworks.com/matlabcentral/answers/2001-what-matlab-easter-eggs-do-you-know#answer_3077 it is Sean de Wolski’s dog. Sean is a relatively new employee at TMW and a frequent contributor to Answers. I think the dog is on his current avatar: http://www.mathworks.com/matlabcentral/answers/contributors/3208495-sean-de-wolski

  2. naor says:

    I too was disappointed last year when I realized the spy was gone. Perhaps it is still reachable in some undocumented way?

  3. Oleg Komarov says:

    Hi Yair,

    the spy snippet has a vertcat error in c as a poster mentioned on SO. I answered with the error free snippet here.

    • @Oleg – thanks. This was due to a bug in the WordPress code that renders < characters – It's now fixed. I had to revert to a sub-optimal non-syntax-highlighted rendering of the code, but at least it's now correct.

Leave a Reply

Your email address will not be published. Required fields are marked *