【发布时间】:2023-04-04 10:24:01
【问题描述】:
我想使用为该类定义的方法更改我的类属性:
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
【问题讨论】:
标签: matlab methods properties