How to keep Simullink Library installed

2 次查看(过去 30 天)
My company uses a custom Library of components for simulation in Simulink. This Library is set up by running a Matlab script. After running the Matlab script this warning shows up:
Warning: Unable to save path to file 'C:\Program Files\MATLAB\R2023b\toolbox\local\pathdef.m'. You can save your path to a different
location by calling SAVEPATH with an input argument that specifies the full path. For MATLAB to use that path in future sessions,
save the path to 'pathdef.m' in your MATLAB startup folder.
Now the problem is that every time I want to access the Library in Simulink I need to run the Matlab script. Is there any way to make the library pernamently installed without the need to run the Matlab script every time I want to access it?
Thank you!

回答(1 个)

Bhanu Prakash
Bhanu Prakash 2024-7-18
编辑:Bhanu Prakash 2024-7-18
Hi Simon,
The warning message you encountered might occur if the 'pathdef.m' file is read-only or located in a directory for which you don't have write access. To resolve this warning, you can try the workflow mentioned below:
1. Run the following command in MATLAB command window:
[status, cmdout] = system(['attrib -r "', fullfile(matlabroot, 'toolbox', 'local', 'pathdef.m'), '"'], 'runAsAdmin')
2. If the 'status' returns '0' ans 'cmdout' is an empty array, you can run your MATLAB script again to set-up the library.
3. If the 'status' is not '0', then you can try the steps mentioned in the warning to save 'pathdef.m' to a different folder where you have write access.
For more information on the above-mentioned workflow, you can refer to the following bug report:
For more troubleshooting steps, you can refer to the workarounds mentioend in the following MATLAB answer:
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by