I want to use the "publish" function to publish my script, e.g.
a = 5; b = 6;
plotab(a,b);
a = 4; b = 5;
plotab(a,b);
while plotab is a function:
function plotab( a,b )
tVec = 0:1:10;
figure;
plot(tVec, a^2 .* tVec);
figure;
plot(tVec, b^2 .* tVec);
end;
Unfortunately the two sections "First Plot" and "Second Plot", defined inside the function, do not appear in the html-document. So the two generated figures are just appended at the end of section "Part a" and "Part b", without any subsection defined inside the function.
How can I publish so that the "subsections", defined inside the function, are documented as well as the sections, defined at main level in the script.