fix an error in gd_matlab if nargout==2