This is a copy of code originally submitted to the Matlab File Exchange: https://www.mathworks.com/matlabcentral/fileexchange ...
function [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) ...