Deployed Matlab function with strage errors: functions not found
显示 更早的评论
Hi there,
I have a new company PC and had to install MATLAB on this PC. I'm currently facing some strange behaviour when deploying my functions and tools written with MATLAB.
I'm using ether MATLAB 2015aSP1 or 2015b as those two versions were the last providing 32bit support. The programs had to run also on older machine PCs therefore this restriction.
However when deploying even a simple function or small tool I always get some strange errors like the self written functions are not found (those functions are in a folder known to MATLAB). When running the functions or programs by MATLAB it works fine. The deployed version does not run.
I've installed the latest update for both MATLAB versions.
Im Using Windows 10 Enterprise (Version 10.019045). The MATLAB version is 8.5.1.959712 (R2015a) Service Pack 1 Update 3.
The first error is in which I run with startup.m
savepath('pathdef.m');
The error says "Error using savepath. Too many input arguments"
Canceling out this line I get errors on other lines. It seems that the depolyed version does not find the folder with all the user functions.
The make it more complicated: on my old company PC it worked fine.
Kind regards,
Christian
采纳的回答
更多回答(2 个)
Steven Lord
2024-9-29
1 个投票
I am fairly certain that the limitation described in the "Do Not Rely on Changing Directory or Path to Control the Execution of MATLAB Files" section on this documentation page is not new and applied to release R2015a (and I think any version of MATLAB Compiler since version 4.0.) Also see the "Packaged Applications Do Not Process MATLAB Files at Run Time" section on that same page.
I think you're going to need to add the path that contains the helper functions to the MATLAB search path before you create the application. That way MATLAB Compiler can include them in the application when it is created.
Vandit
2024-9-29
Hello Christian,
To resolve the error you're encountering, you can try restoring the default path and rehashing the toolbox cache. Please follow the steps below:
- Before modifying the search path, it is important to take a backup of your 'pathdef.m' file, which can be located by using the command:
>> which -all pathdef
- Ensure you make a safe copy of the file by moving it to a folder outside of your MATLAB path.
- After taking the backup, execute the following commands in the MATLAB Command Window to restore the default MATLAB search path and rehash the toolbox cache.
>> restoredefaultpath
>> rehash toolboxcache
>> sl_refresh_customizations
- After this step, kindly check if the issue occurs again. If the issue is resolved, then you may want to save the new MATLAB search path by executing the following command:
>> savepath
- NOTE: This will remove any custom paths you may have created.The following MATLAB Answers post is an additional resource on how to back them up: https://www.mathworks.com/matlabcentral/answers/166871-how-will-running-the-restoredefaultpath-and-savepath-commands-affect-my-custom-paths-and-how-do
If the issue still persists, feel free to contact MathWorks Technical Support using the following link:
Hope this helps.
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!