Borrar filtros
Borrar filtros

Running the matlab class example

18 visualizaciones (últimos 30 días)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan el 3 de Ag. de 2016
Editada: per isakson el 9 de Ag. de 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

Respuesta aceptada

Adam
Adam el 3 de Ag. de 2016
Editada: Adam el 3 de Ag. de 2016
t = Testpoint; % Create the object
t.expectedResult = 7; % Set the property
t.expectedResult % Get the property
for example.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by