Filter löschen
Filter löschen

Constant properties in classes

10 Ansichten (letzte 30 Tage)
Ahmed Hossam
Ahmed Hossam am 17 Mai 2017
Kommentiert: Ganesh Gajavelli am 2 Mär. 2018
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!

Akzeptierte Antwort

Guillaume
Guillaume am 17 Mai 2017
Yes, constant properties can be calculated from other constant properties. It's the first example in the doc actually.
  4 Kommentare
Guillaume
Guillaume am 29 Jul. 2017
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 am 2 Mär. 2018
Yes, that was it for me too! Thanks so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by