Error using biograph function

8 ビュー (過去 30 日間)
Ajay Gautham
Ajay Gautham 2015 年 3 月 28 日
コメント済み: Corey 2015 年 12 月 9 日

Hi, When i was using this piece of code below few months ago, it was running ok. Now its throwing in errors, but displaying the graph somehow. But these red lines when i run the code bothers me. Can you please help me regarding this.

#######################CODE#########
W = [100 200 300 300 400 100 200 200 400 200 100 100];
DG = sparse([1 1 1 2 2 3 4 5 5 6 7 8 ],[2 3 4 5 6 4 6 7 9 8 8 9],W,9,9);
h = view(biograph(DG,[],'ShowWeights','on'));
######################################

$$$$ERRORS#####

   Error using cell2mat (line 52)
  CELL2MAT does not support cell arrays containing cell
  arrays or objects.
Error in
biograph.biograph/hgCorrectFontSize>mycell2mat (line
43)
    m = cell2mat(c);
Error in biograph.biograph/hgCorrectFontSize (line
34)
   set(mycell2mat(get(mycell2mat(get(h.Edges,'hgline')),'UserData')),'FontSize',edgeFontSize)
Error in biograph.biograph/hgUpdate (line 32)
    h.hgCorrectFontSize
Error in biograph.bgguiRbgguiResize (line 220)
bh.hgUpdate
Error using biograph.bggui (line 67)
Error while evaluating Figure SizeChangedFcn

回答 (2 件)

Jiangtao Yu
Jiangtao Yu 2015 年 6 月 18 日
編集済み: Jiangtao Yu 2015 年 6 月 18 日
The most simple way to solve this problem is to note the Line 32 to 35 of the hgCorrectFontSize.m.
just like
% if strcmp(h.showWeights,'on')
% edgeFontSize = max(h.edgeFontSize * scl,minAllowableFontSize);
% set(mycell2mat(get(mycell2mat(get(h.Edges,'hgline')),'UserData')),'FontSize',edgeFontSize)
% end
But this way maybe have an other negative effect.
The best way is to correct these codes.
My solution is to change the code of mycell2mat function begins from Line39 and save.
function m = mycell2mat(c)
if verLessThan('matlab','8.4.0')
% execute code for R2014a or earlier
if numel(c)==1
m = c;
else
m = cell2mat(c);
end
else
% execute code for R2014b or later
n=length(c);
m=gobjects(n,1);
for i=1:n
m(i)=c{i};
end
end
  1 件のコメント
Corey
Corey 2015 年 12 月 9 日
Thanks Jiangtao, that fixed the error on my side.

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


Debarati Banerjee
Debarati Banerjee 2015 年 4 月 2 日
This seems to be a known issue. Currently there are no workarounds to resolve the errors.
  1 件のコメント
Ilya Tyuryukanov
Ilya Tyuryukanov 2015 年 5 月 14 日
編集済み: Ilya Tyuryukanov 2015 年 5 月 14 日
I'm struggling the same story, 'ShowWeights' triggers the problem!

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

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by