Is there a way to "pass by value" from a handle class?

3 ビュー (過去 30 日間)
Sam
Sam 2017 年 9 月 10 日
回答済み: Walter Roberson 2017 年 9 月 10 日
If I have a class, "MyClass" as a subclass to the handle class, how can I pass the variable "a" out by value using R2014a?
  1 件のコメント
per isakson
per isakson 2017 年 9 月 10 日
編集済み: per isakson 2017 年 9 月 10 日
  • what kind of variable is a ?
  • what kind of value does a have ?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 10 日
Construct a parallel non-handle class with equivalent properties and methods, and invoke its constructors with the properties of the handle class object to create a non-handle equivalent.
This presumes that when you say "pass by value" that it will not be necessary for the routine being passed into to modify the original object using evalin() or assignin() with the expectation that that would change the handle version as well.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by