이 제출물을 팔로우합니다
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다
The handle or hgsetget classes miss a method to make deep copies of objects. The two classes "handleplus" and "hgsetgetplus" take care of this.
To use these classes, ...
- simply put them somewhere on your Matlab path.
- in classdef-files change instances of
"classdef MyClass < handle" (or hgsetget)
to
"classdef MyClass < handleplus" (or hgsetgetplus)
Suppose you have defined a "MyClass" as child of "handleplus". Deep copies are now created as follows:
>> OBJ = MyClass;
>> OBJ_new = OBJ.copy;
Some short notes:
- This implementation (hopefully) also handles deep copying of inherited private or protected properties (s. discussion "Clone Handle Object - using MATLAB OOP" -> link in acknowledgments).
- It handles properties, which contain handle-objects
- It does not handle cyclic references (s. mathforum.org/kb/message.jspa?messageID=7629086&tstart=0)
Please read the help for these files for more details and report any bugs.
Cheers
Sebastian
인용 양식
Sebastian Hölz (2026). Copy / Clone method for handle and hgsetget class (https://kr.mathworks.com/matlabcentral/fileexchange/34762-copy-clone-method-for-handle-and-hgsetget-class), MATLAB Central File Exchange. 검색 날짜: .
도움
도움 받은 파일: Clone Handle Object - using MATLAB OOP
| 버전 | 퍼블리시됨 | 릴리스 정보 | Action |
|---|---|---|---|
| 1.0.0.0 |
