In order to work with Google Earth, you should specify the WGS 84 ellipsoid in your code by replacing lines 4 and 5 with:
utmstruct.geoid = almanac('earth','wgs84','meters');
if you are working in meters, or:
utmstruct.geoid = almanac('earth','wgs84','kilometers');
if you are working in kilometers, etc.
UTM was designed in the first half of the 20th century, well before artificial satellites made a global system like WGS 84 possible. So different local datums (and their ellipsoids) were used for UTM in different parts of the world. The purpose of the utmgeoid function is to do a geographic look-up of the standard ellipsoid for a given zone. But now UTM is used with datums like NAD 83 and WGS 84, which did not exist when it was originally defined. The utmgeoid function is not relevant in such cases.
The statement in the solution, "MATLAB’s default reference ellipsoid is International, not WGS 84" is misleading. It really should say something like: "defaultm uses the International ellipsoid for UTM when the ellipsoid and zone unspecified." (The International ellipsoid is the default only in this context.)
Best Answer