Standalone error : Accessible file is now inaccessible and mclFreeStackTrace

7 views (last 30 days)
I have used matlab 2013b compiler to create a standalone application of my matlab code. I can install the standalone application but when I try to run it, it gives me two errors:
-Previously accessible file [C:\filepathtocode.m] is now inaccessible.
-Error in mclFreeStackTrace
My code is very simple :
function helloworld
figure
title('Hello, World.', 'FontSize', 12, 'FontWeight', 'Bold');
end
Here is a step-by-step of what lead me to this problem. To create the exe, I use deploytool into Application Compiler. I chose my main file and chose to have the run time downloaded form the web. Once its packaged, I run the installation successfully, but it always show me those two errors. What is causing this?
EDIT: I tried to install it on another computer and I only get the error about the mclFreeStackTrace. Also I have double checked that MCR version 8 is installed.
  2 Comments
Louis-Daniel Théroux
Louis-Daniel Théroux on 7 Dec 2015
No, its just the file path to the matlab code. I have edited my question to make it clearer, I am sorry for the confusion.

Sign in to comment.

Accepted Answer

Bharath Rangaswamy
Bharath Rangaswamy on 16 Dec 2015
This might occurs because there are paths being added using ADDPATH in the startup.m or matlabrc.m file.
When a standalone application is compiled using MATLAB Compiler, the commands in the these files are also executed and these paths are not recognizable in the compiled standalone application. Hence, the error occurs.
To resolve this, use the "isdeployed" flag to ensure the commands in these files are not executed by deployed applications.
For example, if(isdeployed) % some code that does not have else addpath(...) end
An alternative is to just rename the startup.m and matlabrc.m file before building the standalone application. This workaround is explained below. 1. Find the location of these files with the commands below.
>> which -all startup.m >> which -all matlabrc.m
Some file might not be located in your directory and might 'not found' message.
2. Rename the files for which location is given. For eg., startup1.m , matlabrc1.m
3. Compile your application
4. Execute your standalone application and see if that solves the issue
5. Change the names of the files you renamed to 'startup.m' and 'matlabrc.m'.

More Answers (1)

Louis-Daniel Théroux
Louis-Daniel Théroux on 16 Dec 2015
Used isdeployed to ensure the startup.m doesn't execute and now it works. Thanks you.

Categories

Find more on Search Path 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!