The “Module not on path” error that you are facing while using the custom Battery Pack library occurs when MATLAB is unable to find the required components in its search path.
The “Batteries.slx” file references the components present in the “+Batteries_lib” package folder. This package folder defines a namespace for better organization of files.
Based on the error that you are facing it is evident that the “Batteries.slx” file is unable to find the “+Batteries_lib” package folder.
The error can be resolved in the following ways:
- Change the current working directory in MATLAB to the folder where the “Batteries.slx” and the “+Batteries_lib” package folders are present and use the files and libraries in that particular folder.
- Add the parent folder in which the files “Battery.slx” and “+Batteries_lib” package folder is present by right clicking the parent folder in MATLAB files window and select “Add to path” and then select “add folders and sub folders” option.
By using any of the two ways mentioned above, MATLAB would be able to find all the components of “+Batteries_lib” package resolving the given error.
For more information on resolving linking errors while using these libraries you can refer to the following documentation links:
I hope it helps.