testcalss.m
classdef testcalss properties(Access = public) a; F; end methods(Access = public) function this = testcalss() if (1 == 1) this.F = eval('@(x)a * x'); eval('this.a = 5'); end end function Calculate(this) a = this.a; this.F(1); end end end
test.m:
global solver; solver = testcalss(); solver.Calculate();
I execute test and after it I get such message:
Undefined function or variable 'a'. Error in testcalss/testcalss/@(x)a*x Error in testcalss/Calculate (line 18) this.F(1); Error in test1 (line 3) solver.Calculate();
Where is my bug?
Best Answer