how to call a get.properties method in a script
显示 更早的评论
Hi, I'm trying to use the get.propertie function on a private propertie.
classdef t_point2D
properties (Access = private)
X;
Y;
end
methods
%Defenir le constructeur
function point2D = t_point2D(X,Y)
if nargin == 0
point2D.X =0;
point2D.Y=0;
elseif nargin == 1 || nargin >2
fprintf('Error');
else
point2D.X = X;
point2D.Y = Y;
end
end
%accesseurs
function X = get.X(point2D)
X = point2D.X;
end
Then, I try to call it in a script :
point1 =t_point2D(2,8);
XX = get.X(point1);
I get the following error message : Undefined variable "get" or class "get.X".
Error in test (line 4) XX = get.X(point1);
I supposed I'm not calling the method the right way? I can't find the doc on how to call a get.prop function.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Argument Definitions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!