MATLAB Community

MATLAB, community & more

A Frightful Error

It’s late October. The nights are getting longer (for us North Americans, anyway), and vampire processes are sucking the life from your machine. Even a hard power cycle won’t banish the ghost of yesterday’s horrific memory usage. Halloween can’t be far away. How can we honor the season with appropriately creepy code?

With some help from Alex Caulway and Connell D’Souza here at the MATLAB Central Global Headquarters building, I decided to craft a suitably scary M-file. But what would it do? What would it say? I asked myself this question: what are some truly terrifying things for a MATLAB user to hear?

Then I cranked out a few drawings and wrote some simple code.

Here’s the code. Save it and run it and you’ll get one of short list of images and messages designed to frighten even the most jaded of modern MATLAB users.

function msg = boo
    %BOO  A Halloween message for your friends
    %    Insert this command into your favorite code: error('%s',boo)
    b = imread('');
    p = [ ...
    m = { ...
    i = randi(length(m),1,1);
    set(gca,'Visible','off','DataAspectRatio',[1 1 1]);
    title(char(m{i}),'Color','white','FontSize',15,'FontName','Times New Roman','Visible','on')

    if nargout>0
        msg = "Fatal error. " + char(m{i});

Here’s an example of what you see when you run it.

For even more Halloween fun, open up a friend’s code and (after putting the “boo.m” code on the path) insert this line somewhere random.


Then lurk. Lurk with the patience of an evil lurking thing.

And by the way, what messages would you add to the list here? What are more some scary messages updated for the modern engineer and scientist?

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.