From a9cae46b10631d3afaec6c2cdf5a383a8c1f6bb9 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 15 Sep 2012 02:53:54 +0000 Subject: [PATCH] Plot Bayes net within matlab ! (dot -> png -> imread -> imshow). --- matlab/+gtsam/plotBayesNet.m | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 matlab/+gtsam/plotBayesNet.m diff --git a/matlab/+gtsam/plotBayesNet.m b/matlab/+gtsam/plotBayesNet.m new file mode 100644 index 000000000..dea9b04ad --- /dev/null +++ b/matlab/+gtsam/plotBayesNet.m @@ -0,0 +1,8 @@ +function plotBayesNet(bayesNet) +% plotBayesNet saves as dot file, renders, and shows as image +% Needs dot installed + +bayesNet.saveGraph('/tmp/bayesNet.dot') +!dot -Tpng -o /tmp/dotImage.png /tmp/bayesNet.dot +dotImage=imread('/tmp/dotImage.png'); +imshow(dotImage) \ No newline at end of file