MATLAB superclass can not be found on the MATLAB&#

2019-03-03 19:23发布

问题:

I have 2 paths :

  • C:\controller\functions\verifyModel.m
  • C:\OGVD\prod\KMLP\controller\controllerStatus.m

verifyModel.m

classdef verifyModel 
    methods(access=public)
        function...
    end
end

controllerStatus.m

classdef controllerStatus < verifyModel     
   .....
end

but when I run controllerStatus.m, I got an error as the class I used isn't in the path how could I add verifyModel to the path ?

回答1:

Before usage of controllerStatus use:

addpath('C:\controller\functions\')

Also, you might want to put in in a @ folder. These folders are added to the path whenever they are visible, so as they are a subfolder of your current path(pwd).

Or add 'C:\controller\functions\' to your static matlab path, what I do not recommend.

See also this answer.



标签: matlab class oop