4.6 | 5 ratings Rate this file 44 Downloads (last 30 days) File Size: 16.2 KB File ID: #27608
image thumbnail

GraphViz-like tools for MATLAB


Jonathan Lister


14 May 2010 (Updated )

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

| Watch this File

File Information

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 <Guillaume@artefact.tk>
 (Which I can no longer find on the exchange)


Fdep: A Pedestrian Function Dependencies Finder and Matlab Graph Viz Layout Importer inspired this file.

This file inspired Plot Depfun and Plot Subroutines.

MATLAB release MATLAB 7.10 (R2010a)
Other requirements fdep : http://www.mathworks.com/matlabcentral/fileexchange/17291-fdep-a-pedestrian-function-dependencies-finder
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (14)
16 Jul 2014 Christopher Pedersen

Christopher Pedersen

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;

Comment only
16 Mar 2014 Christopher Pedersen

Christopher Pedersen

@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]);

Comment only
23 Dec 2013 James


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

Comment only
06 Dec 2013 Jonathan Lister

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?

Comment only
30 Nov 2013 James


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)

Comment only
30 Nov 2013 James


(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)

Comment only
16 Jan 2013 Aurelien Queffurust

Aurelien Queffurust

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

31 May 2012 Jonathan Lister

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.

Comment only
30 Apr 2012 Michael Quinn

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', 'outfile.dot')
>> ha = axes;
>> mGraphViz('outfile.dot',ha)

24 Feb 2012 reez all

reez all

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

15 May 2010 Jonathan Lister

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

Comment only
14 May 2010 Jim Dowd

Jim Dowd

14 May 2010 us


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...]


Comment only
14 May 2010 us


15 May 2010

added fdep in the Other Requirements field

Contact us