Constant properties in classes

15 ビュー (過去 30 日間)
Ahmed Hossam
Ahmed Hossam 2017 年 5 月 17 日
コメント済み: Ganesh Gajavelli 2018 年 3 月 2 日
Hi,
is it possible to define a constant property in a class which depends on other constant properties in the same class?
Would that also be correct?
thank you for your answer in advance!

採用された回答

Guillaume
Guillaume 2017 年 5 月 17 日
Yes, constant properties can be calculated from other constant properties. It's the first example in the doc actually.
  4 件のコメント
Guillaume
Guillaume 2017 年 7 月 29 日
As shown in the very first example in the link in my answer, you have to use the syntax:
classdef App1
properties (Constant)
a = 1;
b = App1.a+1;
end
Ganesh Gajavelli
Ganesh Gajavelli 2018 年 3 月 2 日
Yes, that was it for me too! Thanks so much!

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

その他の回答 (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