File Exchange

image thumbnail

plot_depfun

version 1.14.0.0 (9 KB) by Christopher Pedersen
plots a graph of the dependencies of a function

11 Downloads

Updated 08 Oct 2016

View Version History

View License

wrapper for depfun that plots the results to a node graph of dependencies
faster than regular depfun due to using multiple calls with the -toponly option.

Cite As

Christopher Pedersen (2021). plot_depfun (https://www.mathworks.com/matlabcentral/fileexchange/46080-plot_depfun), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (34)

Adam Miller

This should be a built-in - very useful!

Yaad Ram

Great stuff, recommended.

Cecil Wilson

Very good !

Mathworlds

Very cool tool, thank you. To graph all the functions in a same directory I just create a file -with the directory name- in which I just list them all. Is there a smarter way to get the same result ?

Bob

I've downloaded my fair share of code from File Exchange, but this worked right out of the box - fast, gorgeous plot, and oh so informative. Someday I hope to be as useful a contributor as you have been. Many thanks!

Nicolas Pipard

Simple to use. Works well in R2018b
I meant @Bruce

Nicolas Pipard

@Christopher : I was wondering the same. Seems like the blue color means that the functions are located in the same folder than the function foo, and red when it's in a different folder

micholeodon

Sean Wu

Mason Wright

This worked amazingly for me. Thank you.

Richard Griffiths

Brilliant

Renwen Lin

very useful!

nagaditya poluri

great tool;

Huy Cu

Siddharth Shekhar

Excellent

Jack German

Bruce

What do the colors in the plot signify?
Any way to get toolbox usage included?

Thanks for the feedback - I have updated the file and it should now be working with both edge and node comments.

Zi-Xiang WANG

Great tool.

I used the "-comments" option of plot_graph and noticed they mismatched the "names" input.

Happened to find a bug at line 413, and corrected if by replacing :
set(h,'String',{get(h,'String'),opt.comments{i}})
with :
set(h,'String',{get(h,'String'),opt.comments{ opt.node(i).index }})
so as to get the comments in the right order.

Hope it will be included in the next version!

Regards,
Zi-Xiang

Thierry Dalon

I've tried to explain here http://tdalon.blogspot.de/2016/09/matlab-editor-customized-shortcuts.html how to integrate the utility in the MATLAB Editor by adding a Shortcut in the Quick Access Toolbar. Maybe you can incorporate this improvement.

Mohak

Can plot_depfun and plot_subfun be integrated?

Christopher Pedersen

Thanks for the feedback, John.
I'm guessing that the input to plot_graph is wrong for some reason. Could you put a "keyboard" command on the second line of plot_graph and check the inputs ? they should be:
names = {'plot_depfun','plot_graph'}
from = 1;
to = 2;
varargin = {'-colour','bb'}

Also, for the record I assume you're using windows ?
Regards,
Chris Pedersen

John Peach

I'm using R2016a and getting the following error:
>> plot_depfun('plot_depfun')
Error using plot_graph>sub_opt (line 37)
unknown options: must be string or cellstring array

This happens on the first iteration of i (line 33), and val = varargin{i} = [3 2].

Do you have any suggested fixes for this?

Muhammad

GREAT!!

Roy

This looks like a nice program, but I have not gotten it to work yet. How do I troubleshoot the program when it lands on a "keyboard" command, e.g. on line 241 of plot_graph.m?

Stefan Grandl

Marco Wassmer

Thanks works great now

Christopher Pedersen

Hi Bruce - the reason you got this file instead is simple. I'm an idiot and uploaded the wrong file over at plot_subfun. That should now be fixed. As to your question:

A simple example is: plot_depfun('plot_depfun'), which plots the dependecy tree of the function plot_depfun itself. In this case, you will get a figure with two boxes: plot_depfun, and plot_graph, the only other function it depends on.

as to additional inputs, if you type:
plot_depfun('somefunction','a','b','c') you will get the dependency tree for "somefunction", but the functions a,b,c will be ignored (it will be treated as if the function has no dependencies on a,b or c.)

The list of functions to ignore has to be strings. They can be full filenames (e.g. 'c:\folder\somefun.m'), filenames (e.g. 'somefun.m') or just function names (e.g. 'somefun').

Hope that helps.

Bruce Elliott

For some reason I got this function when I tried to download its cousin, plot_subfun (?), but this one looks good, too. Some documentation would be a big help, though. Are there any examples? What inputs are allowed in the varargin input? Options? This looks like a great tool - I just need a few hints. Thanks!

Christopher Pedersen

@Marco - thanks for the feedback. I've fixed the bug that wasn't ignoring functions correctly. Let me know if the latest version works for you.

Marco Wassmer

very nice, but the ignoring of the functions in varargin seems not to be working.

Matthew

No longer errors on simple test case.
>> plot_depfun('plot_depfun')

Christopher Pedersen

Matthew - thank you for the feedback.
I had accidentally submitted a test version of the code.
Apologies to everyone who has previously downloaded this file, the new version actually works !

Matthew

Could be a really cool tool. However, there are several errors: E.g., Error in plot_depfun>sub_deps (line 60), Error in plot_depfun>sub_deps (line 78).

The code quality is fairly poor.

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!