Matlab Deployment not working

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 个评论

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.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2016-10-14

0 个投票

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 个评论

Hi Walter. Thank you very much for your reply. Do you mean that I j have to change the start directory?
Best regards,
Michael
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
Hi. Thanks! I will try this as soon as possible and get back you!
Regards,
Michael

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

标签

提问:

2016-10-14

评论:

2016-10-15

Community Treasure Hunt

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

Start Hunting!

Translated by