Jakob Toftegaard
Jakob Toftegaard

Reputation: 73

Matlab call function in same package

It there an easy way to call to access a class in the same package without specifying the package name.

Example

I have a package name foo with the classes bar and bar2, lets say I want bar2 to be a subclass of bar, I will then write

classdef bar2 < foo.bar

Is there a way were I can tell matlab that it should look in the same package.

The reason I want that is if I change the package name to fo I would have to change it in all files within the package.

Upvotes: 1

Views: 445

Answers (2)

Chris Taylor
Chris Taylor

Reputation: 47402

The Matlab documentation explicitly says that you need to include the package name when subclassing (even if you are in the same package).

Referencing Superclasses Contained in Packages

If a superclass is contained in a package, include the package name. For example:

  classdef stock < financial.asset
     methods
        function s = stock(asset_args,...)
           if nargin == 0
              ...
           end
           % Call asset constructor
           [email protected](asset_args); 
           ...
        end
     end
  end

Upvotes: 1

Edric
Edric

Reputation: 25160

Unfortunately I believe there is no way to do this. Yes, it's annoying.

Upvotes: 2

Related Questions