jrdriller
jrdriller

Reputation: 1

how do i ensure that matlab is calling the correct function when the same function is imported in multiple toolboxes

tau = 5;
K = 2;
A = -1/tau;
B = K/tau;
C = 1;
D = 0;

sys = ss(A,B,C,D)
Undefined function 'ss' for input arguments of type 'double'.

 >> which -all ss
 /Applications/MATLAB_R2016b.app/toolbox/ident/ident/
  @idParametric/ss.m           % idParametric method
 /Applications/MATLAB_R2016b.app/toolbox/shared/controllib/engine/
  @StaticModel/ss.m            % StaticModel method
 /Applications/MATLAB_R2016b.app/toolbox/signal/signal/
 @dfilt/ss.m                   % dfilt method

the function ss appears to be imported in 3 toolboxes. not sure what the problem is here, ive tried reseting the path to default, removing the toolbox function from the path, etc.

Upvotes: 0

Views: 41

Answers (1)

Suever
Suever

Reputation: 65460

ss is a method that is defined for the various classes (idParametric, StaticModel and dfilt). Which version of ss is called depends on the class of the first input to the function. For example if you have have an idParametric object named obj, ss(obj) or ss.obj() will call the ss method that is defined for that specific class. In this way, you can have a single function name which behaves differently for different datatypes or objects.

If your case, your first input is of class double for which the ss method is not defined resulting in an error.

Upvotes: 1

Related Questions