Can't set Biograph edges individually

2 ビュー (過去 30 日間)
Dan
Dan 2014 年 6 月 3 日
コメント済み: Dan 2014 年 6 月 3 日
I would like to set some edge properties individually (color, linewidth, etc). Although this looks like it should be possible (since interrogating these properties return a cell array (with a scalar value for each edge)), trying to set these properties fails!
Example: %Create a matrix & labels cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0]; ids = {'M30931','L07625','K03454','M27323','M15390'}; bg2 = biograph(cm,ids);
%Getting the linewidths returns a cell array The_Linewidths=get(bg2.edges,'linewidth')
%But trying to set the linewidths with a cell array (even the one returned!) fails! set(bg2.edges,'linewidth',The_Linewidths)
Error using biograph.edge/set Parameter must be scalar.
Any ideas? Otherwise... it's back to graphviz! (Which I think does this...)

採用された回答

Lucio Cetto
Lucio Cetto 2014 年 6 月 3 日
bg2.edges is an array of biograph.edge objects. With set you can set the LineWidth porperty of multiple objects to the same line width. To set each biograph.edge to a different line width you need to use a for-loop.
for i = 1:numel(The_Linewidths)
set(bg2.edges(i),'linewidth',The_Linewidths{i});
end
HTH Lucio
  1 件のコメント
Dan
Dan 2014 年 6 月 3 日
Ah! Sorry about that. I misunderstood.
Thank you for your lucid explanation!
Dan

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by