0

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 ?

Amro
  • 123,847
  • 25
  • 243
  • 454
lola
  • 5,649
  • 11
  • 49
  • 61

1 Answers1

0

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.

Community
  • 1
  • 1
Nick
  • 3,143
  • 20
  • 34
  • I don't want to add it with addpath within the class , is there a way so that the file is added automaticaly ? – lola Sep 20 '13 at 09:43
  • Humm! I interested for @folder , I didn't used before : so I can put the class in : C:\controller\functions\@function\verifyModel.m Then no need to call addpath ? – lola Sep 20 '13 at 09:50
  • C:\controller\functions\@verifyModel\verifyModel.m The @folder should have the same name as its classdef file. There's no need to call addpath as long as C:\controller\functions\ is on your path or your current folder – Nick Sep 20 '13 at 09:51
  • I have error with path : I just changed : C:\controller\functions\@verifyModel\verifyModel.m and from controllerStatus.m : classdef controllerStatus < verifyModel – lola Sep 20 '13 at 10:00
  • Do I need something in controllerStatus ? – lola Sep 20 '13 at 10:00
  • If verifyModel can't be found when it's in c:\controller\functions then creating a @verifyModel folder under functions and putting verifyModel there wont work either. The @[folder] only works when the folders parent is on the Matlab path. As far as I can tell, @[folder] only make sense for classes that have methods in multiple files. – grantnz Sep 22 '13 at 09:56