Matlab Compiler Magic Numbers example won't work

3 views (last 30 days)
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?

Answers (3)

Titus Edelhofer
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
Ryan Matheson
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
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

Sign in to comment.


Image Analyst
Image Analyst on 29 Jan 2013
Exactly how are you trying to run the exe on the target computer?

Noah Frere
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
  1 Comment
Jintao Chen
Jintao Chen on 17 Nov 2016
Edited: Jintao Chen on 17 Nov 2016
Hi Noah,
Hope you have solved your problem already. First thing first, there is no need to modify the output sh program.
For the issue of:
Not enough input arguments.
My answer may sound stupid, but you may want to check to see if you added below code at the beginning of your code out of practice, which I did.
clc; clear;
It removes the argument I just input. Remove it if you have it.
For the issue of
Reason: image not found
The command
./magicsquare.app/Contents/MacOS/magicsquare 5
you used doesn't make sense for me because - you first miss the space between used app and reference file - you are referring to only the library related with magicsquare but not other essential library for the standalone executable to run
Try this command instead and it may solve your issue
./run_magicsquare.sh /Applications/MATLAB/MATLAB_Runtime/v901 5'
Hope it helps.
Appreciate you sharing your questions here, it helped me to solve my issue.

Sign in to comment.

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!