matlab中自定义类的格式为:
classdef
classname
propertiesPropName
end methodsmethodName
end eventsEventName
end enumerationEnumName
end end例如
classdef BasicClass properties Value end methods function r = roundOff(obj) r = round([obj.Value],2); end function r = multiplyBy(obj,n) r = [obj.Value] * n; end end end
详情见http://cn.mathworks.com/help/matlab/matlab_oop/create-a-simple-class.html