Is there a "once" function?

Hi all,
I have an array of objects that should each have a property serverDir set. Setting this property requires a little bit of effort and computation time (checking folders etc).
When I put this logic inside a "Dependent = True" property of my class, this logic is run on every object in my array of objects.
Is there a natural location to store the serverDir information so that it only gets run once by the first object that requests this property, and each subsequent object re-uses this result?
Thanks, Sven.

 採用された回答

Sven
Sven 2011 年 10 月 28 日

0 投票

The answer was in the form of a "persistent" variable.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSoftware Development Tools についてさらに検索

質問済み:

2011 年 6 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by