License problem only when running Matlab in a csh script on Linux
Show older comments
Hi everyone,
I wrote a matlab program for automatc generation of some plots. I use the "shaperead" function, as well as other functionalities and I have installed the Mapping toolbox as well as all toolboxes needed. When I launch my program in the matlab command window it runs.
Anyway, when I launch it within a .csh script I have the following error:
"shaperead requires Mapping Toolbox"
I found here a simila problem, where it was suggested to reinstall and run again the mathworksservicehost toolkit.
I did it and it worked for one day, but after two days I have the same problem.
This solution is not suitable when you have to schedule automatic processes.
I use an Ubuntu 20 OS and MatlabR2024a academic license
Thank you for your help
Answers (1)
Umar
on 5 Jul 2024
Edited: Walter Roberson
on 5 Jul 2024
Hi Annalina,
The error occurs because the environment variables or paths necessary to locate the Mapping Toolbox are not set correctly when running the script from the .csh script. This leads to Matlab not finding the required toolbox, resulting in the error. To resolve the issue, you can explicitly add the path to the Mapping Toolbox in your Matlab script. This ensures that Matlab can locate and access the required toolbox even when running from a .csh script.Here is an example of how you can add the toolbox path in your Matlab script:
% Add the path to the Mapping Toolbox
addpath('/path/to/Mapping_Toolbox');
Make sure to replace '/path/to/Mapping_Toolbox' with the actual path where the Mapping Toolbox is installed on your system. To prevent this issue from recurring, you can set the path to the Mapping Toolbox in your Matlab startup file or script. By doing so, Matlab will always have access to the required toolbox regardless of how the script is executed. You can add the path to the Mapping Toolbox in your startup.m file as follows:
% Add the path to the Mapping Toolbox
addpath('/path/to/Mapping_Toolbox');
By setting the path in the startup file, you ensure that Matlab loads the Mapping Toolbox automatically whenever Matlab is launched, avoiding the "shaperead requires Mapping Toolbox" error in the future.
Categories
Find more on Startup and Shutdown 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!