- Undocumented Matlab - https://undocumentedmatlab.com -

Spy Easter egg take 2

Posted By Yair Altman On April 4, 2012 | 6 Comments

Three years ago, I posted a short post [1] 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 [2] comics series:

>> spy;

Matlab spy Easter egg

As was recently reported [3] 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'
'<A;FB:;bfj8^df//DGIF<5]UF+ZH-eM>-IorRPNMPIE-Y\\R8[I8]SUDW2e+'
'=4BGC;<cgk9_e00DEOJG=6^VG,[I.fN?5jpsSQPNQPF.Z,]S9`S9cTWVX:+,'
':5CHD<=4hlh`f11EFPKHA7&WH-\J/gOC?kqtTRRORQJ8--^TB+T=dWYWY;,_'
';6D3E=>7imiag2IFOQLID8''XI.]K0"PD@l32UZhP//P988_WC,U>+Z^Y\<2`'
'<82BF>?8jnjbhLJGPRMJE9/YJ/`L1#QMC$;;V[iv09QE99,XD.YB,[_\]=3a'
'>9;CG?@9kokc2MKHQSOKF:0ZL0aM2$RNG%AAW\jw9E.FEE-_G8aG.d`]_W5+'
'?:CDH@A:lpld3NLIRTPLG=1[M1bN3%SOH4BBX]kx:J9LLL8`H9bJ/+d_dX6,'
'@;DEIAB;mqmePOMJSUQMJ>2\N2cO4&TPP@HCY^lyDKEMMN9+I@+S8,+deY7^'
'8@EFJBC<4rnfQPNPTVRNKB3]O3dP5''UQQCIDZ_mzEPFNNOE,RA,T9/,++\8_'
'9A2G3CD=544gRQPQUWUOLE4^P4"Q6(VRRIJE[`n{KQKOOPK-SE.W:F/,,]Z+'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T6*VE.*@JFEJEEE0.NNWTK,U@+TEG0?+_bX'
';2D@L9`dh6\bdcbBEGD:3[S=)U7+cK/+CKGFLIKI9/OWZUL-VA,WIHB@,`cY'];
i = double(c(:)-32);
j = cumsum(diff([0; i])<=0) + 1;
S = sparse(i,j,1)';
spy(S)


Happy Easter / Passover everybody!

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


6 Comments (Open | Close)

6 Comments To "Spy Easter egg take 2"

#1 Comment By Daniel Shub On April 4, 2012 @ 12:07

If you trust the comment at MATLAB answers: [12] 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: [13]

#2 Comment By Michelle Hirsch On April 10, 2012 @ 09:00

Close, but it’s not Sean’s dog. The dog belongs to the lead developer of the sparse matrix functions in MATLAB.

#3 Comment By naor On April 4, 2012 @ 20:39

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

#4 Comment By Yair Altman On April 5, 2012 @ 00:39

@Naor – I’ve added an addendum showing how you can regenerate the old spy image

#5 Comment By Oleg Komarov On June 29, 2013 @ 04:18

Hi Yair,

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

#6 Comment By Yair Altman On June 29, 2013 @ 11:03

@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.


Article printed from Undocumented Matlab: https://undocumentedmatlab.com

URL to article: https://undocumentedmatlab.com/articles/spy-easter-egg-take-2

URLs in this post:

[1] short post: http://undocumentedmatlab.com/blog/spy-easter-egg/

[2] Spy vs. Spy: http://en.wikipedia.org/wiki/Spy_vs._Spy

[3] reported: http://blog.developpez.com/matlab4geek/p10681/pensee-matlab-du-jour/notre-vieil-espion-qui-a-pris-sa-retrait/?page=2

[4] training courses: http://undocumentedmatlab.com/training/

[5] email me: mailto:%20altmany%20@gmail.com?subject=Matlab%20courses&body=Hi%20Yair,%20&cc=;&bcc=

[6] Spy Easter egg : https://undocumentedmatlab.com/articles/spy-easter-egg

[7] Image Easter egg : https://undocumentedmatlab.com/articles/image-easter-egg

[8] ishghandle's undocumented input parameter : https://undocumentedmatlab.com/articles/ishghandle-undocumented-input-parameter

[9] Plot LimInclude properties : https://undocumentedmatlab.com/articles/plot-liminclude-properties

[10] Plot legend title : https://undocumentedmatlab.com/articles/plot-legend-title

[11] Customizing axes part 5 – origin crossover and labels : https://undocumentedmatlab.com/articles/customizing-axes-part-5-origin-crossover-and-labels

[12] : http://www.mathworks.com/matlabcentral/answers/2001-what-matlab-easter-eggs-do-you-know#answer_3077

[13] : http://www.mathworks.com/matlabcentral/answers/contributors/3208495-sean-de-wolski

[14] : http://stackoverflow.com/questions/17378200/matlab-easter-egg-spy-vs-spy/17379616#17379616

Copyright © Yair Altman - Undocumented Matlab. All rights reserved.