Live Editor and view neural network

6 ビュー (過去 30 日間)
Grzegorz Knor
Grzegorz Knor 2017 年 7 月 27 日
コメント済み: Baptiste Ottino 2017 年 8 月 8 日
I would like to add a neural network graphical diagram to my live script. Unfortunately command view produces new window instead of adding diagram to the live script.
To be clear, this code (in a Live Editor) attaches output of plot command directly to the live script, but does not include neural network diagram:
net = patternnet;


Baptiste Ottino
Baptiste Ottino 2017 年 8 月 8 日
You are experiencing this problem because the view(net) function does not output a figure, it outputs a Java object. I don't know a perfect work around, but you can try this:
function newView(net)
jframe = view(net);
%# create it in a MATLAB figure
hFig = figure('Menubar','none', 'Position',[100 100 565 166]);
jpanel = get(jframe,'ContentPane');
[~,h] = javacomponent(jpanel);
set(h, 'units','normalized', 'position',[0 0 1 1])
%# close java window
I found this solution here. With this, you can have your network as a figure, and it will appear in the livescript. The only remaining issue is that the undocked figure window doesn't close once it has been plotted in the livescript, which is peculiar.
  2 件のコメント
Baptiste Ottino
Baptiste Ottino 2017 年 8 月 8 日
Pretty cool, thank you very much!


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by