Method invocation using dot notation error
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Luuk Poort
am 29 Sep. 2021
Kommentiert: Luuk Poort
am 29 Sep. 2021
Hello,
I have extended the built-in class mechss to add some additional methods.
In the simplest sense, see the class definition below.
classdef mss < mechss
%MSS Extension of MECHSS class
methods
function obj = mss(varargin)
% Constructor method
obj = obj@mechss(varargin{:});
end
function showM(obj)
% Simple method displaying the first block of the mass matrix
disp(full(obj.M(1:10,1:10)));
end
end
end
Now, if I want to call the method showM of an instance of an mss object, documentation says I can use both the dot and function notation. The function notation functions correctly, but the dot notation gives me an error, as shown below.
msys = mss(M,K,B,F,G,D); % Creating an instance of the mss object, using arbitrary second order system matrices
showM(msys); % Functions correctly
msys.showM(); % Gives the error shown below
Error using InputOutputModel/subsref (line 43)
No property of the class "mss" matches the identifier "showM". Use PROPERTIES to get the list of properties for this class.
It thus shows an error in the subsref function. Further study shows that specifically line 29 of the subsref funciton (see below) throws the error that the number of output arguments is too large, although it only gives one output when executed without any output.
% Line 27-29 from the subsref function, located in
% C:\Program Files\MATLAB\R2020b\toolbox\shared\controllib\engine\@InputOutputModel\subsref
Struct(1).subs = ltipack.matchProperty(Struct(1).subs,...
ltipack.allprops(M),class(M));
result = builtin('subsref',M,Struct(1));
Using the dot notation using a very simple super- and subclass does work, so it seems an issue with the InputOutputModel class.
Is it possible to fix the dot notation functionality?
Thank you.
PS: I am using MATLAB 2020b and the control system toolbox for the mechss functionality.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Methods finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!