From: Matt J on
"Hugo " <hresquiveloa(a)gmail.com> wrote in message <hv37m7$j10$1(a)fred.mathworks.com>...
> Matt,
>
> Thanks for reply...
>
> And if beta and gamma are properties of the class/object??? I mean,
>
> [obj.T obj.A] = functionToGetTandA(obj.beta, obj.gamma, alpha, theta);
>
> How can I update T and A when beta and gamma are changed of value.
=======

Why not write an update method

function obj=updateTandA(obj,newBeta,newGamma)

[obj.T obj.A] =functionToGetTandA(newBeta,newGamma, alpha, theta);

end
From: Hugo on
Matt,

Thanks!!!

But, now I have another problem... Please consider the following class definition...


classdef DR
properties
Tf=5;
R;
end

methods
function obj=updateR(obj,value)
obj.R=value+obj.Tf;
end

function displayR(obj,value)
obj.updateR(value);
fprintf('The R value is: %d\n',obj.R)
end
end
end



Why when I type the following in the prompt:
>> s=DR
>> s.displayR(4)

the R value is not displayed on the screen as one would expect? Can you please tell me where the problem/error is?

Many Thanks!!!
From: Daniel on
I think you want a handle class instead of a value class...


"Hugo " <hresquiveloa(a)gmail.com> wrote in message <hv3vmv$pmn$1(a)fred.mathworks.com>...
> Matt,
>
> Thanks!!!
>
> But, now I have another problem... Please consider the following class definition...
>
>
> classdef DR
> properties
> Tf=5;
> R;
> end
>
> methods
> function obj=updateR(obj,value)
> obj.R=value+obj.Tf;
> end
>
> function displayR(obj,value)
> obj.updateR(value);
> fprintf('The R value is: %d\n',obj.R)
> end
> end
> end
>
>
>
> Why when I type the following in the prompt:
> >> s=DR
> >> s.displayR(4)
>
> the R value is not displayed on the screen as one would expect? Can you please tell me where the problem/error is?
>
> Many Thanks!!!
From: Hugo on
Daniel,

Thank you very much. Now everything is working as expected.
From: Matt J on
"Hugo " <hresquiveloa(a)gmail.com> wrote in message <hv3vmv$pmn$1(a)fred.mathworks.com>...

> function displayR(obj,value)
> obj.updateR(value);

Instead of making this a handle class, you coul also have changed the above to

obj=obj.updateR(value);