Invalid default value for property error in class properties
이전 댓글 표시
Greeting
I made a class and run dthe code in .m file
classdef myclass
properties (Constant)
a=physconst('LightSpeed');
b=a/2
end
end
it occurs error and says
Invalid default value for property 'b' in 'myclass':
Unrecognized function or variable 'a'.
physconst("LightSpeed") is a function in addon which name is 'Phased Array System Toolbox'
and its version is 4.3
a=physconst('LightSpeed')
b=a/2
I put thosdde two lines in command window
and it works fine...
so I have removed constant and tried to initialize them with class constructor
classdef myclass
properties
a;
b;
end
methods
function obj=myclass(obj)
a=physconst('LightSpeed');
b=a/2;
end
end
end
but the same error occured
I want to initialize my class property value with addon function but it have bring out error
How to deal with this error?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Antennas, Microphones, and Sonar Transducers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!