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!

posted @   菜鸡一枚  阅读(467)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
历史上的今天:
2015-06-04 心静是一种境界
2015-06-04 毕业答辩前的三大纪律八项注意
2015-06-04 论文写不下去了怎么办?
2015-06-04 研究生学术创新的五个阶梯
2015-06-04 林语堂:读书须有胆识,有眼光,有毅力
2015-06-04 CCF推荐国际学术期刊
2015-06-04 CCF推荐国际学术会议
点击右上角即可分享
微信分享提示