How to addParameter and validateattributes for several values at once (OOP)?

조회 수: 3 (최근 30일)
Armindo
Armindo 2016년 2월 2일
Basically I have the MainObject and I want to add to this object the Obj1 (FilterObj) e Obj2 (RotObj). When I just need to add one object I do something like:
function set.PipeBolt(obj,val)
if ~isempty(val)
validateattributes(val, {'FilterObj'},{'size',[NaN,1]});
else
val = FilterObj.empty;
end
obj.PipeBolt = val;
end
and in constructer something like
addParameter(parser,'PipeBolt',FilterObj.empty,@(x)validateattributes(x,'{FilterObj'},'PipeLineBolt','PipeBolt'))
let say that FilterObj is Obj1 but for Obj1 (RotObj) how can I adjust the code to pass and validate atributes both types of objects?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by