# Publishing called functions

Posted by Jiro Doke,

Jiro's pick this week is "Publish dependent and called functions" by Nick Angelini.

Publishing is one of the things I always highlight to MATLAB users, new or experienced. Even though the feature has been around for over 7 years, not many people know about it. I was one of those people who went through graduate school manually creating reports from figures generated in MATLAB. Now, publishing is something that I can't live without. Even many of the bloggers (myself included) on MATLAB Central use publish to write the blog posts.

I was pretty excited to see this entry by Nick. I've always wanted to make something like this, but I never got around to implementing it. While publish would only generate a report for the function or the script you specify, publishdepfun will generate separate reports for any user-defined functions used in the main file, and even append the report to the end of the main report. I immediately found one of my demos that I show at seminars and published it. The syntax is pretty much identical to the MATLAB's publish command. You can also pass in the options structure that's accepted by publish.

publishdepfun('MainAnalysis');

My MainAnalysis.m script had 3 custom functions: createFit.m, createfigure.m, and importfile.m. Those 3 functions were published as well and were appended to the end of the main report. As you can see below, the report has a section called "Called Functions".