Problem with properties in App Designer.
Show older comments
Hello. I need help with "properties" in App Designer. I have some trouble with realization the method of symmetrical components.
properties (Access = public)
a = -.5 + sqrt (3) / 2 * j; % Phase-shift operator
F = [1 a^2 a; 1 a a^2; 1 1 1]; % Matrix Fortescue
end
Message: "Invalid default value for property 'F' in class 'App1': Undefined function or variable 'a'."
If I replace "a" with "app.a" in the Matrix Fortescue.
Message: "Invalid default value for property 'F' in class 'App1': Undefined variable "app" or class "app.a"."
Answers (1)
Steven Lord
on 28 Jul 2017
0 votes
Since you're probably not going to want a and F to change based on the state of your app, make them Constant properties, properties with the Constant attribute.
6 Comments
New
on 28 Jul 2017
Steven Lord
on 29 Jul 2017
You want to define the property app.b in terms of the property app.a, not a variable a. In the first example on the documentation page to which I directed you, note how property NamedConst.D is defined in terms of property NamedConst.R and not on a variable named R.
Steven Lord
on 29 Jul 2017
The name of your app class is App1? Then you need App1.a. In general if your app class was named CLASSNAME, you would use CLASSNAME.a.
Steven Lord
on 29 Jul 2017
That is correct IF you're referring to a property of an instance of the class. A Constant property can be accessed even if you don't have an instance of the class, and the way you do that is by using the name of the class.
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!