Constant properties in classes

6 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Software Development Tools 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by