Miscellaneous helpful MATLAB functions