Neural network Matlab-如何保存Matlab神经网络的视图配置

Neural network Matlab-如何保存Matlab神经网络的视图配置,neural-network,matlab,matlab-figure,Neural Network,Matlab,Matlab Figure,我正在尝试使用matlab和newff命令配置一个神经网络 x = view(net); 之后,我尝试使用view命令可视化创建的配置 x = view(net); 如何将显示的窗口保存到.png文件?我试过使用saveas(x,'figure.png','png')但它不起作用?你知道如何从代码中实现吗?我也有同样的问题,特别是当我试图保存神经网络工具箱(nntraintool)生成的绘图时。我用剪贴工具捕捉那些情节。但是,请尝试使用以下选项: 确定需要捕捉的gfx对象(其控制柄)。它将来

我正在尝试使用matlab和
newff
命令配置一个神经网络

x = view(net);
之后,我尝试使用
view
命令可视化创建的配置

x = view(net);

如何将显示的窗口保存到
.png
文件?我试过使用
saveas(x,'figure.png','png')
但它不起作用?你知道如何从代码中实现吗?

我也有同样的问题,特别是当我试图保存神经网络工具箱(nntraintool)生成的绘图时。我用剪贴工具捕捉那些情节。但是,请尝试使用以下选项:

确定需要捕捉的gfx对象(其控制柄)。它将来自可识别的属性。然后您可以使用打印选项将其保存到文件中;您需要写入文件名、类型;有关详细信息,请转到此链接()

例如,如果要使用标记“performance.fig”保存图形,可以尝试:

h = findobj('Type', 'figure', 'tag', 'performance.fig');

    for k = 1:numel(h)

    print(h(k), sprintf('Pic%d.ps',k));

    end;

如果这有帮助,请告诉我,您必须根据需要修改代码。我还从stackoverflow论坛的另一个人那里得到了这个帮助。

创建的窗口是纯Java图形(不是MATLAB Handle图形)。尝试以下方法来捕获它:

%# neural net, and view it
net = feedforwardnet(5);
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
jframe.setVisible(false);
jframe.dispose();

%# print to file
set(hFig, 'PaperPositionMode', 'auto')
saveas(hFig, 'out.png')

%# close figure
close(hFig)

我正在尝试获取NNTrainToolBox的结果,并创建网络配置图、生成的训练快照以及性能、训练状态和回归图

看了这个建议之后,7。关于statck overflow,我设计了下面的代码来解决这些问题。我会为我的计划风格道歉,并期望为解决这些问题做出贡献

%***************************************************************************
% TrainingToolDisplays
%***************************************************************************

function [] = TrainingToolDisplays(net,P,T) 

%***************************************************************************
% After configuring the net, do a silent net training
%***************************************************************************

net.trainParam.showWindow = 0;
net = train(net,P,T);

%***************************************************************************
% Create a figure for the net configuration
%***************************************************************************

jConfig = view(net);
hConfig = figure('Name','Neural Network Configuration', ...
                 'NumberTitle','off', ...  
                 'Menubar','none', ...
                 'Position',[100 100 600 200], ...
                 'PaperPositionMode', 'auto', ...
                 'Visible','on');

jPanel = get(jConfig,'ContentPane');
[~,h] = javacomponent(jPanel);
set(h, 'units','normalized', 'position',[0 0 1 1])
jConfig.setVisible(false)
jConfig.dispose

%***************************************************************************
% Create a figure for the nntraintool training snap shot
%***************************************************************************

jTrainTool = nntraintool('handle');
hTrainTool = figure('Name','Neural Network Training', ...    
                    'NumberTitle','off', ...  
                    'Menubar','none', ...
                    'Position',[100 100 600 600], ...
                    'PaperPositionMode', 'auto', ...
                    'Visible','on');

jPanel = get(jTrainTool,'ContentPane');
[~,h] = javacomponent(jPanel);
set(h, 'units','normalized', 'position',[0 0 1 1])
jTrainTool.setVisible(false)
jTrainTool.dispose

%***************************************************************************
% Plot the plots you want and get the handles 
%***************************************************************************

nntraintool('plot', 'plotperform');    hPerform = gcf;
nntraintool('plot', 'plottrainstate'); hTrainState = gcf;
nntraintool('plot', 'plotregression'); hRegression = gcf;

%***************************************************************************
% Now you may do whatever you may want with those matlab handles
% hConfig, hTrainTool, hPerform, hTrainState and bRegression
%***************************************************************************

return
%*******************************************************************************
这将不起作用(无论是
findobj
还是
allchild(0)
都不会找到有问题的窗口)