I've found myself trying to interface a custom class with builtin functions, and I've encoutered a situation I could only solve with eval, I'd like a "cleaner" way.
Basically, the builtin function is defined as varargout=blabla(varargin)
I defined an overriden function in the custom class, as varargout=blabla(varargin)
. The function looks like:
function varargout=blabla(varargin)
varargout=blabla(function_of_varargin)
end
The function of varargin
transforms it from the custom class to the builtin clas.
But it doesn't work as-is: Basically when the builtin function is called inside the overriden function, it sees only one output parameter (varargout
), even if the custom overriden function is called with more than one output parameter.
I solved it by basically calling this :
[varargout{1},varargout{2},...,varargout{nargout}]=blabla(function_of_varargin)
Constructing the LHS with a loop and eval-ing.