localfunctions returns function handles to all the local functions in an m-file. However, this doesn't work in a package. For example, the following code saved as 'a.m' runs fine:
function fs = a()
fs = localfunctions;
end
function babo()
end
function hidden()
end
Called from MATLAB console:
>> a()
ans =
@babo
@hidden
But when it is inside a package as '+aaa/b.m', I get nothing:
>> aaa.b()
ans =
{}
I don't think this behavior is well documented. How do I overcome this?
I need to use localfunctions
to unit test some functions within the package and I don't want to keep it outside of the package just because of this.