Reputation: 3384
I am working with matlab packages and I want to make a package available to all methods in same .m file. I am trying to import the package in main method of .m file and it seems to me that other functions in .m file are unable to access the package. I do not want to import package in all functions and want to avoid this situation. Is there a way to tackle this issue.
Upvotes: 2
Views: 544
Reputation: 25160
In short: no. Unfortunately, in MATLAB you must always use the fully qualified name of a function, even if you're in the same packaged (or else use import
statements).
Note that adding the +mypackage
directory to the MATLAB path doesn't work - you'll get the warning:
>> addpath +mypackage
Warning: Package directories not allowed in MATLAB path: +mypackage
> In path (line 109)
In addpath (line 88)
Upvotes: 2