How to run a standalone executable compiled in older version FROM console

3 views (last 30 days)
I have a standalone executable that was compiled in MCR 9.1 (I do not have the original files)
I need to run that standalone executable from a script in matlab R2018b (MCR 9.5).
I have installed MCR 9.1.
Running the executable on its own works fine. However, when I try to run it from Matlab it complains about not being able to find MCR 9.1
I also tried calling a bat file from Matlab, but it still complains (running the bat file by itself works like a charm).
Any tips?

Accepted Answer

Andrew Janke
Andrew Janke on 31 Jan 2020
Check the state of the %PATH% environment variable from within Matlab. Matlab adds its own libs to the PATH, and those libs overlap what is in the MCR, so when you're running a compiled-Matlab command via system() from within Matlab 9.5, you're running it against MCR 9.5, even if you have MCR 9.1 installed separately on your computer. You will probably have to make a little batch file that re-adds the MCR 9.1 lib paths to the front of your %PATH% variable, and call your standalone app through that bat file.

More Answers (0)


Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!