Unable to add S-function to MATLAB path when using "addpath"
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 16 Feb 2017
Answered: MathWorks Support Team
on 16 Feb 2017
I am experiencing an unusual issue where Simulink can't find a compiled S-Function, even when the folder that the function is located in is on the MATLAB path. I see an error saying "Double2Str.c cannot be found" or the like.
The commands I'm using to add the required folders to the MATLAB path are as follows :
addpath(genpath('apps/examples'));
addpath('lib');
addpath(genpath('robots'));
Accepted Answer
MathWorks Support Team
on 16 Feb 2017
The commands you listed will not add the 'examples' folder located under 'apps' to the MATLAB path. This is because MATLAB R2016a does not implicitly add the path of the present working directory to the string arguments in "addpath", especially when you're trying to add subfolders. The commands you can use instead are as follows:
addpath(genpath([pwd '/apps/examples']));
addpath([pwd '/lib']);
addpath(genpath([pwd '/robots']));
Please note that in MATLAB R2016b, "addpath" implicitly adds the path of the present working directory. Therefore, the original commands would work in MATLAB R2016b.
0 Comments
More Answers (0)
See Also
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!