필터 지우기
필터 지우기

How to display aggregation and composition in Class Diagram Viewer?

조회 수: 15 (최근 30일)
Mahmoud Elzouka
Mahmoud Elzouka 2022년 5월 9일
편집: Jan Kappen 2024년 6월 18일
I note that there are no aggregation or composition in the legend. Is it beause Class Diagram Viewer doesn't support them?
If it support them, how do I make sure these relationships are working?
  댓글 수: 2
Jon
Jon 2022년 10월 13일
I have the same question. It seems that you have not gotten any responses though. So specifically if a class A has as a property an instance of a class B, then how do you diagram that A "has a" B?
Mahmoud Elzouka
Mahmoud Elzouka 2022년 11월 22일
That is exactly what I need.

댓글을 달려면 로그인하십시오.

답변 (2개)

Aneela
Aneela 2024년 2월 14일
Hi, Mahmoud Elzouka
The “Class Diagram Viewer” shows inheritance relationships very effectively.
Currently the association relationships like aggregation and composition are not supported by the “Class Diagram Viewer app.
For more details regarding the class diagrams and creating them in “Class Diagram Viewer” app, refer to the following link.

Jan Kappen
Jan Kappen 2024년 6월 18일
편집: Jan Kappen 2024년 6월 18일
It does!
You just need to tell MATLAB which type of object you're expecting.
Assuming:
myClass.m
classdef myClass
properties
composition compositionClass % type hint here!
end
methods
function obj = myClass(compObj)
obj.composition = compObj;
end
end
end
compositionClass.m
classdef compositionClass
properties
prop (1,1) double = 1
end
end
This is properly one of the best features added to MATLAB in the last years. See details here: Function Argument Validation - MATLAB & Simulink (mathworks.com)
Be sure to check the box "associations".

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by