"loadlibrary" processes the input parameters individually, so arrays or wildcards will not work.
However, it may be possible to write a small script to process an array of pathnames and generate a "loadlibrary" command string that can be implemented with "eval".
Here's a simple example:
paths = genpath('\path\to\libraries');
pathArr = split(paths, ';');
includeStr = "loadlibrary('yourlib', 'yourlib.m'";
for i = 1:length(pathArr)
includeStr = strcat(includeStr, ",'includepath','",pathArr(i),"'");
end
includeStr = strcat(includeStr, ");");
eval(includeStr);
The 'includeStr' should include all the paths we would like to input to 'loadlibrary' function and then, we can simply call it using 'eval'.
Best Answer