Matlab refresh function cache
Matlab might not use newly-compiled MEX functions if the function cache is not cleared. This can happen when the MEX function was previously called before building the MEX code. For example, suppose a project has a Matlab function timestwo.m and optionally MEX compiled function also called timestwo.
function y = timestwo(x)
disp("this is plain Matlab script")
y = 2 * x;
end
If one builds the MEX function with the same name and then calls the function, Matlab may not use the MEX compiled version until the function cache is cleared. Clear the Matlab function cache, thereby enabling newly-compiled MEX functions to be used by command
clear functions
% or
clear all
These commands do NOT clear the function cache:
% these don't help
rehash
rehash path
clear mex