silly me, I should not have included the markup heading inside the nested function. Remove these and the publish command works fine.
function test1
%%Individual sample reports
reportSample;
%%overall summary
reportSummary
function reportSample
for i = 1 : 5
disp( [ '<html><h3>sample ' num2str( i ) '</h3><hr></html>' ] );
end
end
function reportSummary
disp( [ '<html><h3>summary</h3><hr></html>' ] );
end
end
%