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.

4.66667
7 Ratings

26 Downloads

Updated

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:
mkdotfile
Inspired by mdot of M2HTML
by Guillaume Flandin <Guillaume@artefact.tk>
(Which I can no longer find on the exchange)

Comments and Ratings (17)

yuchen

yuchen (view profile)

This tool is dependent on fdep, which is dependent on depfun, which was deprecated in MATLAB v2016a according to this thread: https://se.mathworks.com/matlabcentral/answers/282974-how-to-list-all-function-dependencies-in-v2016

Ashkan

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
else
for i=1:numel(patchObj);
p(i) = patchObj{i};
end
patchObj = p;
end

@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

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

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

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:

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

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

us

us (view profile)

Updates

1.1

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