MATLAB Answers

Ryan Matheson
0

Matlab Compiler Magic Numbers example won't work

Asked by Ryan Matheson
on 29 Jan 2013
Latest activity Answered by Noah Frere
on 3 Aug 2016

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?

  0 Comments

3 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).

Titus

  7 Comments

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

c:/programfiles/Matlab20XXx/extern/compiler/magicsquare.m

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.

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.

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

cd c:\PathToYourExecutable\
magicsquare 5

Where 5 is the parameter n.

Titus


Answer by Image Analyst
on 29 Jan 2013

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

  0 Comments


Answer by Noah Frere
on 3 Aug 2016

Hello all. I am having a similar problem, but with MATLAB R2016a. I compiled magicsquares and ran it from terminal in Mac 10.11.4 El Capitan. Here's my command:

 Noahs-MacBook-Pro:application noahfrere$ ./run_magicsquare.sh /Applications/MATLAB/MATLAB_Runtime/v901

and here's the result:

 Setting up environment variables
---
DYLD_LIBRARY_PATH is .:/Applications/MATLAB/MATLAB_Runtime/v901/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v901/bin/maci64:/Applications/MATLAB/MATLAB_Runtime/v901/sys/os/maci64
Not enough input arguments.
Error in magicsquare (line 7) 
MATLAB:minrhs

I did not enter the argument this time since I followed the prescription that worked for a different function:

 function hello
    disp('hello jill')
 end

which worked just fine, using in Terminal:

 Noahs-MacBook-Pro:for_redistribution_files_only noahfrere$ ./run_hello.sh /Applications/MATLAB/MATLAB_Runtime/v901

which output:

 ------------------------------------------
Setting up environment variables
---
DYLD_LIBRARY_PATH is .:/Applications/MATLAB/MATLAB_Runtime/v901/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v901/bin/maci64:/Applications/MATLAB/MATLAB_Runtime/v901/sys/os/maci64
hello jill

When I tried running magic squares as recommended in the Mathworks tutorial:

 Noahs-MacBook-Pro:application noahfrere$ ./magicsquare.app/Contents/MacOS/magicsquare 5

then the result is:

 dyld: Library not loaded: @rpath/libmwlaunchermain.dylib
  Referenced from: /Applications/magicsquare/application/./magicsquare.app/Contents/MacOS/magicsquare
  Reason: image not found
Trace/BPT trap: 5

I tried a little coding following the readme.txt, which says: "If it is defined, set it to the concatenation of these strings:

    ${LD_LIBRARY_PATH}: 
    MCR_ROOT/v901/runtime/maci64:
    MCR_ROOT/v901/sys/os/maci64:
    MCR_ROOT/v901/bin/maci64"

changing the contents of the run_magicsquare.sh file so that it included "v901", which it did not include initially. However, I did not do that for the hello jill function. Either way, I couldn't get the magic squares executable to display the magic square.

Any ideas?

Also, the whole point of this is to eventually make a pretty complicated GUIDE gui executable. -or at least the functions that the gui contains. (that is, it doesn't have to be the gui if Matlab doesn't support that kind of activity). Basically, my code takes a bunch of data and takes the fft(data), the stft(data), graphs it, finds total energy, and finds percent error between the un-interpolated and the interpolated computations, and the frequencies at which the maximum values of the energy spectrum occur, for different sets of data. The idea is that when we get new data, we can analyze all of it with a single click on anyone's computer, rather than import it into Matlab, since not everyone will be using Matlab presumably.

Thanks for any help!

Noah

  0 Comments


Join the 15-year community celebration.

Play games and win prizes!

Learn more
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 Academy

New to MATLAB?

Learn MATLAB today!