Why my code doesn't execute correctly in other computers while works correctly in my computer?
Show older comments
I have a MATLAB code which I turned into an executable file. This code runs correctly in my computer but as soon as I put it in my Laptop for office use or bring it to other computer systems of my office or colleagues' systems, it provides me with the same error that shows error in 3 different lines, which is also shown at figure. However, my code is correct as it runs on my home computer and all my variables are well defined.
Kindly guide me with this issue. I am using MATLAB R2018a for all systems.
Thank you

3 Comments
Sargondjani
on 10 Nov 2021
As the error says coesamethod is not defined. Should this be a function or a variable?
If it is a function, maybe its not on the searchpath? You can check this with:
exist(coesamethod)
Muhammad Osama
on 10 Nov 2021
Walter Roberson
on 11 Nov 2021
Perhaps the code is using run() with a hard-coded path.
Answers (2)
Jan
on 10 Nov 2021
1 vote
The error message means, that the function coesamethod.m was not included during the creation of the executable. Try to include it explicitly.
1 Comment
Muhammad Osama
on 11 Nov 2021
Image Analyst
on 10 Nov 2021
Edited: Image Analyst
on 10 Nov 2021
If it runs in MATLAB then it must be on the path. Did you change the path in the code? If so that would mean it could be found when you ran it in MATLAB but was not included when you compiled it.
mcc -m hyper_mass_size_model_fcn.m
If it was on the path, that would have found all required functions.
If you want, you can attach the code and I can try to compile it and run it.
Try calling the attached function in your startup code and see what functions it lists in the console window.
8 Comments
Muhammad Osama
on 11 Nov 2021
Image Analyst
on 11 Nov 2021
I may need to add that situation to the FAQ where it could help others in the future.
Muhammad Osama
on 12 Nov 2021
Image Analyst
on 12 Nov 2021
Well that sounds really bizarre. Whether or not you even have a compiler on your target computer where you deployed your compiled program should have no effect at all. As far as I know when you run your app it runs your app and then determines what MCR library it needs, and then loads that. And that's all. It does not look to see if the target computer even has a compiler, and even if it did, it should not care if it was different than the development computer where it was actually compiled.
Muhammad Osama
on 13 Nov 2021
Image Analyst
on 13 Nov 2021
Edited: Image Analyst
on 13 Nov 2021
But what would you do if the target computer did not have a full version of MATLAB with the compiler toolbox? There would be no way to compile the app on that computer. But you should still be able to deploy the app to that target computer. Would the problem not occur at all? Does it only occur if you try to deploy it to a computer that also has a compiler on it?
Muhammad Osama
on 15 Nov 2021
Image Analyst
on 15 Nov 2021
You can contact the Mathworks and they will solve it for you. The Compiler toolbox is very expensive so I assume you have a maintenance contract or you've bought it within the past year. They will figure it out. Or you can zip the executable and any run time files needed and I can try to install it here.
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler 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!