Small helpful functions for MATLAB