matlabFunction is not useful to you in this circumstance. Your input function is from the user, not something that you could pre-convert into MATLAB code to be compiled.
matlabFunction itself is part of the Symbolic Toolbox and so cannot be compiled.
Best Answer