%function str = lat2str(deg,n)
function str = lat2str(deg,n)

if nargin == 1, n = 6; end
fdeg = fix(deg);
dd = int2str(abs(fdeg));
form = ['%.' int2str(n) 'f'];
mm = sprintf(form,abs(deg-fdeg)*60);

if deg >= 0, hemi = 'N';
else hemi = 'S'; end

str = [hemi dd ' ' mm];