I have the following code:
classdef ClassA properties A; B; end methods function obj = ClassA(A,B) obj.A = 1; obj.B = 2; obj.foo1(); end function c = foo1(obj,A,B) c = obj.A+obj.B; obj.foo2() end function foo2(obj,c,A) disp(c); disp(obj.A); end end end
I am trying to get the value of variable c from foo1(obj,A,B), and pass to foo2(obj,c,A), when I do so, I get the following error:
Input argument "c" is undefined.
I tried to solve it by write foo2 in this way:
then I got this:
Undefined variable "obj" or class "obj.A"
I would be grateful if you could help me.