File Exchange

image thumbnail

Publish the main and the subfunctions together

version 1.3 (29.6 KB) by

Publishes the main and the subfunctions together into any format as supported by publish command

3 Ratings



View License

The tool "publish_all_functions" extends the capability of the publish command to publish the main function and its subfunctions together into one document html/pdf/...
Syntax: >>publish_all_functions(<function_name>,options)
- <function_name> - Name of the main function that has to be published.
- Use the same syntax format of "publish" command for <options>.
1. >> publish_all_functions(<function_name>,'pdf').
2. >> opts.outputDir = 'C:\';
>> opts.format = 'html';
>>publish_all_functions (<function_name>',opts);
Here are activities done by this utility.
- Reads all the subfunctions of "<function_name>".
- Creates a new file with the name "<function_name>", and copies the main function and the all the subfunctions into this.
- Lists all the "other files" pcodes, mex files and others that are called by <function_name>.m to the user.
- Publish the new file.
All files are placed in directory publish_files_<date>. If the directory already available, then it overwrites the contents.

Constraint: All functions should use either one of the closing command "return" or "end" uniformly between them. Else the function will stop the publishing process.

Demo: Please download the files.
Add the “demo_development_folder” into MATLAB path. Browse the contents in the folders. 'main_sample_function' is the main function for this development folder. Call the publishing tool as follows,
>> publish_all_functions('main_sample_function','html')
>> publish_all_functions('main_sample_function','pdf')
It will create a folder “publish_files_<today_date>” with the “html” subfolder. Refer the “html” subfolder for the published files.

Please share your comments and suggestions for any improvements.

Comments and Ratings (3)

I have the same problem as Andres H. It looks like Matlab is busy but memory consumption increases slowly until I have to force to stop.

BTW Would be great if Mathworks could enhance the existing Publish function in some of the next updates to publish subfunctions along with the main function.

Anyway thanks for the effort in trying to enhance this functionality.

Andres H

I've been trying to output a pdf file, but when I call the function, it just hangs, like it's working. The memory Matlab consumes slowly increases until I force the process to stop.


Dameon (view profile)

This runs perfectly for publishing all functions and nested functions. Only gone about three levels deep but so far.

There is a problem that it crashes MatLab when it tries to publish functions with PLOT's.

Plus a minor detail, the call function commands are a little hard to find in the documentation and are inconsistent in a few places.

After tinkering I found these worked:





Added screenshot to the file submission.


Edited the comments and description.

MATLAB Release
MATLAB 7.11 (R2010b)

Inspired by: Publish dependent and called functions

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video