Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Matlab Compiler Magic Numbers example won't work

Asked by Ryan Matheson on 29 Jan 2013

I have followed the magic number example in the documentation and for whatever reason it will not run at all. All it does is make the "windows ding" noise indicating something went wrong but doesn't give me an explanation.

Is there any additional steps to this example I should be making that aren't described in the text?


Ryan Matheson


2 Answers

Answer by Titus Edelhofer on 30 Jan 2013

Hi Ryan,

a good way to find out: start a windows command window (hit the windows start button, enter "cmd" as command. It should open the black console window.

cd to the folder where your .exe is.

Start the .exe "manually". Errors get displayed then in the cmd window. That should indicate whats wrong (or give you something that you can post so we have a chance to see what went wrong).



Ryan Matheson on 31 Jan 2013

The .m file called magic squares is a pre-made example code that comes with Matlab and can generally be found in


This is a direct example from the resources called "Magic Square Example" which you can find in the help navigator. Essentially my problem is I followed the instructions, which were very simple, and can't figure out what I'm missing. The program should be asking for an input but instead just crashes. I would like to get this example running so I can move on to bigger and more complex things.

Ryan Matheson on 31 Jan 2013

Oh wait I see what you mean by the "7" the error read,

Error using magicsquares < 7 >

I am also using your suggestion at this point and did run it in a console.

Titus Edelhofer on 19 Feb 2013

If you need to pass arguments, you should do so, i.e.,

cd c:\PathToYourExecutable\
magicsquare 5

Where 5 is the parameter n.


Titus Edelhofer
Answer by Image Analyst on 29 Jan 2013

Exactly how are you trying to run the exe on the target computer?


Image Analyst

Contact us