I want to change the value of a property in a Matlab class from a function within the same matlab class. I.e on of the functions in the class is generating a value that I want to assign to a property for that class.
This is the properties of the class:
classdef myclass < handle
properties (SetAccess = public)
notional;
T;
u;
nbrAnnualPayments;
sigma_u;
sigma_s;
s_i;
N2;
cash_flow;
paymentDates;
detTP;
volTP;
..... and this is the set method.
function set.detTP(obj,value)
if ~(value > 0)
error('Property value must be positive')
else
obj.detTP = value;
end
end
Now I want to write something like:
obj.set.detTP(obj, value);
From another function to update the value of the detTP property.
How should i do this? How should the set function be written (i.e. is it written correctly now)? and how should the syntax look like for assigning the new value to the property.
Thanks in advance for your help!