Does the access method of a dependent property get called twice when the property is indexed into?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Naor Movshovitz
am 13 Okt. 2016
Beantwortet: Naor Movshovitz
am 13 Okt. 2016
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 Kommentar
Walter Roberson
am 13 Okt. 2016
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.
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!