plots the subroutines in a function, and their dependencies on each other
Updated 7 Dec 2016

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

plot_subfun('foo.m') plots a node map of the subroutines in the file foo.m, and their dependencies.
The screenshot is a sample output for the function plot_subfun.m itself.
There is a demo of examples which can be shown with web(publish('demo_subfun'))

Cite As

Christopher Pedersen (2024). plot_subfun (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on File Operations in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Fixed bug i unhide code (Thanks Amro).

Fixed bug in plot_graph where node comments appeared in the wrong node. With thanks to Zi-Xiang WANG for spotting the bug.

Added graceful handling of files-not-found, class definitions and scripts when using the -extsub option.

added catch code to handle calls to built-in functions

added -extsub option to recursively find all subroutines in external functions too.

Corrected error : wrong file uploaded

added option to show external function calls in the figure

bugfix to work under 32-bit windows
bugfix to work in folders with spaces

bugfix in plot_graph line 202 : apparently old syntax didn't work on all windows versions.
also fixed line 207 so it gives a meaninful error message !

added -unhide option to show hidden function in grey
bugfix to catch an error in the -ends option
added a demo.
changed name to plot_subfun

bugfix that handles built-in functions, and functions with no subroutines.

added extra options for selectively hiding subroutines.

Added handling of scripts and function without subroutines.
figures now have a 3/4" margin to ensure they fit on the useable area of the screen.

Changed to matlab toolbox format

bugfix : plot_graph was not working on older versions of matlab under windows.

bugfix to correctly handle multiple subroutines with the same name.

small update to plot_graph

added acknowledgements

Added handling of files without subroutines