Clear Filters
Clear Filters

Matlab Deployment not working

10 views (last 30 days)
MikeSv
MikeSv on 14 Oct 2016
Commented: MikeSv on 15 Oct 2016
Hello everyone.
I tried to deploy a Matlab .m file with the deploy tool, but I get some strange errors. The program just opens a Dialog which prompts the user to choose some .lvm files. After that the files are read and some graphs are plotted. The main .m file uses one function from an external file. When I try to install the App I get: "Internal error.Failed to initialize application installer (204)"
If I open the "for_testing" version the program starts I chose some files, but when the function is called I just get: "Invalid file identifier. use fopen to generate a valid file identifier. Error in --> ....m at line 15" (The function uses fopen)
Has anyone ever run into the same issue?
Thanks in advance,
Michael
  1 Comment
Marc Jakobi
Marc Jakobi on 14 Oct 2016
Does it run in Matlab (without deploying it)? Do you have some code you can post? When the error message comes up, you can click on the link to "line 15" and see the code where the error occurs.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 14 Oct 2016
Invalid file identifier in deployed programs is usually related to not being in the directory you think you are. In deployed programs, fopen() of non-absolute paths checks first in ctfroot() and only then proceeds along the usual MATLAB path (so a file in ctfroot overrides a file of the name in the current directory because the current directory is merely the first entry on the MATLAB path). The directory the executable starts in will typically be ctfroot() and will almost certainly not be the user's "current" directory if they started the program by double-clicking on it.
  3 Comments
Walter Roberson
Walter Roberson on 14 Oct 2016
Edited: Walter Roberson on 14 Oct 2016
It means that you should make extensive use of fullfile() so that you know exactly where every image is coming from. Use a relative path (no directory) only for image files that you have instructed MATLAB Compiler to add to the project.
If you need to figure out the user's home directory, then you will nee to look at the Environment Variables by using getenv() . See http://windowsitpro.com/systems-management/what-environment-variables-are-available-windows such as for HOMEDRIVE and HOMEPATH
MikeSv
MikeSv on 15 Oct 2016
Hi. Thanks! I will try this as soon as possible and get back you!
Regards,
Michael

Sign in to comment.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!