我想使用为该类定义的方法更改我的类属性:
classdef triangle<handle
properties
a
h
end
methods
function obj = triangle()
obj;
end
function obj = setProps(obj, a, h)
obj.a = a;
obj.a = h;
end
end
end
来电:
t = triangle();
t.setProps(a, h);
它根本不起作用 - 我收到此错误:
The class 'handle' is not a super-class of class 'triangle', as required to invoke a super-class constructor or method.
Error in triangle (line 13)
function obj = triangle()
我正在使用matlab 2012a。我的代码基于这个例子:link