If, in the auto-generated code from the gui you specify h (the handler to the plots) as an aditional output variable you can access those data.
function [fitresult, gof, h] = createFit(x, y, z)
[xData, yData, zData] = prepareSurfaceData( x, y, z );
ft = fittype( 'lowess' );
[fitresult, gof] = fit( [xData, yData], zData, ft, 'Normalize', 'on' );
figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, [xData, yData], zData, 'Style', 'Contour' );
legend( h, 'untitled fit 1', 'z vs. x, y', 'Location', 'NorthEast' );
xlabel x
ylabel y
grid on
h is an array and you have to guess which component is the one for the contour plot. In my example it was h(1). That component is the same as in [C, h] = contour(...), and you can use it in the same way. h(1).ContourMatrix has the matrix C that contour would output, and, in particular you can write
clabel(h(1).ContourMatrix, h(1))
to have the contour lines of your plot labelled.
Best Answer