%function bstruct = butm2geo(bstruct,utmStruct)
function bstruct = butm2geo(bstruct,utmStruct)

geoid = selectGeoid;

if isfield(bstruct,'northing') & isfield(bstruct,'easting') & ...
	~strcmp(bstruct.northing,'*') & ~strcmp(bstruct.easting,'*'),
	
	[lon,lat] = myutmcalc(bstruct.easting,bstruct.northing,'inverse', ...
		geoid,utmStruct);

	bstruct = setfield(bstruct,'latitude',lat);
	bstruct = setfield(bstruct,'longitude',lon);
	bstruct = rmfield(bstruct,'northing');
	bstruct = rmfield(bstruct,'easting');
end

if isfield(bstruct,'initialn') & isfield(bstruct,'initiale') & ...
	~strcmp(bstruct.initialn,'*') & ~strcmp(bstruct.initiale,'*'),
	
	[lon,lat] = myutmcalc(bstruct.initiale,bstruct.initialn,'inverse', ...
		geoid,utmStruct);
	
	bstruct = setfield(bstruct,'initiallat',lat);
	bstruct = setfield(bstruct,'initiallong',lon);
	bstruct = rmfield(bstruct,'initialn');
	bstruct = rmfield(bstruct,'initiale');
end
