Generalize the clean up variables for MATLAB