I want to define a relatively small class (small enough that it makes sense to do everything inside of one file). I want to reuse a common subfunction between several methods, and having this subfunction inside of the classdef would make it cleaner, easily portable and automatically private. However, I have not been able to do so. Is there any way to accomplish it?
>> d = dummy;>>??? Undefined function or variable 'my_pi'.>>>>Error in ==> dummy>dummy.dummy at 10>> obj.dummy = my_pi(); dummy.m:classdef dummy properties value; end methods function y = my_pi() y = 3.141592; end function obj = dummy() obj.dummy = my_pi(); end endend
Best Answer