File Exchange

image thumbnail

GraphViz-like tools for MATLAB

version 1.1 (16.2 KB) by

Generate a function or script file call tree and plot it in a figure.

7 Ratings



View License

mkdotfile creates a GraphViz dot language representation of the dependencies of a function. mGraphViz plots the directed graph onto a figure. These functions are a small part of a larger project to implement a doxygen like code documentation system within MATLAB that doesn't have any external program dependencies.

Additional Acknowledgments:
Inspired by mdot of M2HTML
by Guillaume Flandin <>
(Which I can no longer find on the exchange)

Comments and Ratings (17)


yuchen (view profile)

This tool is dependent on fdep, which is dependent on depfun, which was deprecated in MATLAB v2016a according to this thread:


Ashkan (view profile)

Perfect tool to see subfunctions and their relation with the core.

This appears to break under R2014B. Can be fixed by replacing line 282 with:
if verLessThan('matlab','8.4.0')
patchObj=cell2mat(patchObj); %original line 282
for i=1:numel(patchObj);
p(i) = patchObj{i};
patchObj = p;

@James. I had the same error (on a mac).
You can replace line 134 with the following to explicitly tell matlab where to find mwdot:
foo = fullfile(matlabroot,'bin',lower(computer),matlabEngine);
[status,returnCode]=system([foo ' -Tplain ' dotFile]);


James (view profile)

@Jonathan, I am using 2013a and Mac OSX 10.9

Jonathan Lister

@James, I have no idea what to tell you about that one. Sounds like the mathworks dot program is not in the right place or that your install of MATLAB has a problem. This has been working since at least 2009a, but I haven't tried it with 2013b yet. What platform and version are you using?


James (view profile)

I followed Michael's instruction and get the error:

Error using mGraphViz (line 137)
An error occurred when trying to run
the layout engine. The system said,
"/bin/bash: mwdot: command not found

(I can see that there is a mwdot executable is inside the /bin/maci64, and have tried copying it to a new folder /bin/bash with no success)


James (view profile)

(I can see that there is a mwdot executable is inside the /bin/maci64, and have tried copying it to a new folder /bin/bash with no success)

Very nice and useful to write some developer's guide.

Jonathan Lister

Sorry for the lack of examples, and the delay in response. I've not been able to access this account until recently. I will try to include something new in the near future.

Michael Quinn

I agree that an example would be nice to show the basic usage. It took me a few minutes to figure this out. Here is my simple example:

>> mkdotfile('yourfile.m', '')
>> ha = axes;
>> mGraphViz('',ha)

reez all

can anyone post the example to used this file? i still not understand to use it.

Jonathan Lister

Thanks us. fdep is a great function to build upon many kudos to you. My intent is to use fdep as the core of a new documentation system for MATLAB. I've started with M2HTML, but have ripped out a lot of the author's original code in favor of fdep. I'll look into more error checking, if you have anything in mind please send me a note jlister1 @ utk . edu

Jim Dowd


us (view profile)

sorry, somehow the comment got lost...

1) it would be great if the size of the arrow head could be set by an option as well...
2) it would be great to have a bit more error checking on some of the options...
[x) nice use of the pedestrian fdep, by the way...]



us (view profile)



added fdep in the Other Requirements field

MATLAB Release
MATLAB 7.10 (R2010a)

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

» Watch video