Filter löschen
Filter löschen

Deleting required object properties data for calculating dependent properties data without deleting the data in dependent properties.

1 Ansicht (letzte 30 Tage)
Hi everybody. I created a class using the knowledge in https://ch.mathworks.com/help/matlab/matlab_oop/example-representing-structured-data.html Let me take the example of the above mentioned link and ask my question:
... properties (Dependent) Modulus end
methods function modulus = get.Modulus(obj) ind = find(obj.Strain > 0); modulus = mean(obj.Stress(ind)./obj.Strain(ind)); end end
My Question: Only when I add the data to the properties: Stress, Strain the property Modulus is shown/calculated. This is fine. Is there a method on how to, after getting the result of Modulus, delete the data within the properties Stress and Strain whithout deleting the data in the property Modulus?
  1 Kommentar
Greg
Greg am 15 Sep. 2018
Bearbeitet: Greg am 15 Sep. 2018
I don't think so, but why would you want to do that?
Let me elaborate - the point of dependent is that there never is any data in the dependent property. It is calculated on demand each and every time it is accessed.
I just had a scary idea that might suffice as a workaround. If you can explain the use case, and don't get anywhere, I'll try to write up an example and post tomorrow.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Stress and Strain 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!

Translated by