Does the access method of a dependent property get called twice when the property is indexed into?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a class with a dependent property z. The method get.z(obj) returns a vector. This:
y = myObj.z(end);
appears to call get.z twice! The profiler shows 2 calls from the parent function and the run time is twice the expected run time. On the other hand:
x = myObj.z;
y = x(end);
calls get.z once and cuts down run time by half. Is this the intended behavior?
댓글 수: 1
Walter Roberson
2016년 10월 13일
I speculate that one of the two is due to the "end", as it would need to find the size . This is just speculation on my part, though.
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!