Running the matlab class example

7 Ansichten (letzte 30 Tage)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan am 3 Aug. 2016
Bearbeitet: per isakson am 9 Aug. 2016
This is an example provided by MATLAB for ''Modify Property Values with Access Methods''. How to run this?
classdef Testpoint
properties
expectedResult = [];
end
properties(Constant)
scalingFactor = 0.001;
end
methods
function obj = set.expectedResult(obj,erIn)
if erIn >= 0 && erIn <= 100
erIn = erIn.*obj.scalingFactor;
obj.expectedResult = erIn;
else
obj.expectedResult = NaN;
end
end
function er = get.expectedResult(obj)
er = obj.expectedResult/obj.scalingFactor;
end
end
end

Akzeptierte Antwort

Adam
Adam am 3 Aug. 2016
Bearbeitet: Adam am 3 Aug. 2016
t = Testpoint; % Create the object
t.expectedResult = 7; % Set the property
t.expectedResult % Get the property
for example.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by