GraphViz4Matlab 安装
GraphViz4Matlab 安装
GraphViz
GraphViz4Matlab + Matlab2015a + Windows7
GraphViz4Matlab 是一个MATLAB toolbox,能够利用GraphViz提供的一些exe绘图。
原始链接:Matlab Central FileExchange
后来说在Github上维护了: –Link–
(1) GraphViz的安装
Notes on how to build Graphviz on Windows. N.B. Except in rare cases, such as a desire to modify the core Graphviz code, there is no need to build Graphviz on Windows from source. We strongly recommend that one should just install one of the available binary packages from here. If you insist, we will answer questions but basically you are on your own.
我的PC是win7,所以下载windows exe:
安装完成之后,添加“C:\Program Files (x86)\Graphviz2.38\bin”路径到System Path中【注意路径要以自己的安装路径为准,这个bin文件夹内包含很多的exe,可以看一下哦】:
GraphViz 安装完毕~
(2) GraphViz4Matlab 调用 GraphViz
在MATLAB命令行运行以下代码:
addpath(genpath('D:\m_func\graphViz4Matlab_03Mar2010\graphViz4Matlab'));% 注意这个路径应该是下载解压后的graphViz4Matlab路径
load smallExample
nodeColors = {'g','b','r','c'}; % if too few specified, it will cycle through
edgeColors = {'Tom', 'Bill', 'r'
'Bill' 'all' , 'g'};
graphViz4Matlab('-adjMat',adj,'-nodeLabels',names,'-layout',Treelayout,'-nodeColors',nodeColors,'-edgeColors', edgeColors);
发现报错:
neato - graphviz version 2.38.0 (20140413.2041)
dot - graphviz version 2.38.0 (20140413.2041)
twopi - graphviz version 2.38.0 (20140413.2041)
neato - graphviz version 2.38.0 (20140413.2041)
fdp - graphviz version 2.38.0 (20140413.2041)
dot - graphviz version 2.38.0 (20140413.2041)
错误使用 rectangle
Rectangle 类中没有 DisplayName 属性。
出错 graphViz4MatlabNode/drawNode (line 193)
obj.rechandle = rectangle(...
这应该是代码和我的Matlab2015a兼容性问题了。
这个bug已经有人在Github上问过了,”Pull Requests” 中(–link–):
解决办法:删除\util\graphViz4MatlabNode.m中201行!
修改之后再执行上述m代码:
Bingo!

浙公网安备 33010602011771号