MATLAB library for N-D patch work