⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nnimport.m

📁 神经网络预测控制程序的源代码
💻 M
📖 第 1 页 / 共 3 页
字号:
function nnimport(cmd,arg1,arg2,arg3)
%NNIMPORT Neural Network Import GUI for the Neural Network Controller Toolbox.
%
%  Synopsis
%
%    nnimport(cmd,arg1,arg2,arg3)
%
%  Warning!!
%
%    This function may be altered or removed in future
%    releases of the Neural Network Toolbox. We recommend
%    you do not write code which calls this function.
%    This function is generally being called from a Simulink block.

% Orlando De Jesus, Martin Hagan, 1-25-00
% Copyright 1992-2002 The MathWorks, Inc.
% $Revision: 1.5 $ $Date: 2002/04/14 21:11:16 $


% CONSTANTS
tag= 'Import_NN_Par_fig';

% DEFAULTS
if nargin == 0, cmd = ''; else cmd = lower(cmd); end

% FIND WINDOW IF IT EXISTS
fig=findall(0,'type','figure','tag',tag);
if (size(fig,1)==0), fig=0; end

if length(get(fig,'children')) == 0, fig = 0; end

if fig
   ud = get(fig,'userdata');
end

if strcmp(cmd,'init')
  if fig==0  
    StdColor = get(0,'DefaultFigureColor');
    PointsToPixels = 72/get(0,'ScreenPixelsPerInch');
    StdUnit = 'points';
    ud.Handles.parent=arg1;
    ud.Handles.type_net=arg2;
    ud.Handles.ret_func=arg3;
    
    if strcmp(ud.Handles.type_net,'nnpredict') | strcmp(ud.Handles.type_net,'narma_l2')
       me = 'Import Neural Network Plant Parameters';
    else
       me = 'Import Neural Network Plant-Controller Parameters';
    end
    
    fig = figure('Units','points', ...
      'Interruptible','off', ...
      'BusyAction','cancel', ...
      'HandleVis','Callback', ...
    'Color',StdColor, ...
    'IntegerHandle','off', ...
    'MenuBar','none', ...
    'Name',me, ...
    'NumberTitle','off', ...
    'PaperUnits','points', ...
    'Position',PointsToPixels*[7 94 526 195], ...
    'Tag',tag, ...
     'WindowStyle','modal');
   h1 = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'Position',PointsToPixels*[11 9 165 152], ...
    'Style','frame');
   h1 = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'Position',PointsToPixels*[54 148 81 20], ...
    'String','Import From:', ...
    'Style','text');
   ud.Handles.Wbutton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'Callback','nncontrolutil(''nnimport'',''radiobutton'',gcbf);nncontrolutil(''nnimport'',''workspace'',gcbf);', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[20 115 100 19], ...
    'String','Workspace', ...
    'Style','radiobutton', ...
    'Tag','Wbutton', ...
      'ToolTipStr','If selected, the network objects will be taken from the MATLAB workspace.',...
    'Value',1);
   ud.Handles.Mbutton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'Callback','nncontrolutil(''nnimport'',''radiobutton'',gcbf);nncontrolutil(''nnimport'',''matfile'',gcbf);', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[20 87 100 19], ...
    'String','MAT-file', ...
    'Style','radiobutton', ...
      'ToolTipStr','If selected, the network objects will be taken from a MAT-file.',...
    'Tag','Mbutton');
   set(ud.Handles.Wbutton,'UserData',[ud.Handles.Mbutton]);
   set(ud.Handles.Mbutton,'UserData',[ud.Handles.Wbutton]);
   ud.Handles.FileNameText = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
     'Enable','off', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[20 60 141 20], ...
    'String','MAT-filename:', ...
    'Style','text', ...
      'ToolTipStr','Enter the name of the MAT-file where the network objects are.',...
    'Tag','FileNameText');
   ud.Handles.FileNameEdit = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',[1 1 1], ...
     'Enable','off', ...
    'Callback','nncontrolutil(''nnimport'',''clearpath'',gcbf);nncontrolutil(''nnimport'',''matfile'',gcbf);', ...
    'HorizontalAlignment','left', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[20 40 141 20], ...
    'String','', ...
    'Style','edit', ...
      'ToolTipStr','Enter the name of the MAT-file where the network objects are.',...
    'Tag','FileNameEdit');
   ud.Handles.BrowseButton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
     'Enable','off', ...
    'Callback','nncontrolutil(''nnimport'',''browsemat'',gcbf);', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[20 14 142 20], ...
    'String','Browse', ...
      'ToolTipStr','Browse the disk to select a MAT-file.',...
    'Tag','BrowseButton');
   h1 = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[179 44 149 117], ...
    'Style','frame');
   ud.Handles.ModelText = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[193 148 123 20], ...
    'String','Workspace Contents', ...
    'Style','text', ...
    'Tag','ModelText');
   ud.Handles.ModelList = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',[1 1 1], ...
    'Position',PointsToPixels*[187 49 134 103], ...
    'Style','listbox', ...
    'Tag','ModelList', ...
      'ToolTipStr','Present the network objects found in the MATLAB workspace or MAT-file.',...
    'Value',1);
   h1 = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[369 44 149 117], ...
    'Style','frame');
   h1 = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[379 148 130 20], ...
    'String','Neural Network Models', ...
    'Style','text');
    EditUd = struct('ListIndex',0,'String','');
    if strcmp(ud.Handles.type_net,'nnmodref')
      h1 = uicontrol('Parent',fig, ...
       'Unit',StdUnit, ...
       'BackgroundColor',StdColor, ...
       'HorizontalAlignment','left', ...
       'ListboxTop',0, ...
       'Position',PointsToPixels*[383 112 75 22], ...
       'String','Controller', ...
       'Style','text', ...
       'Tag','ControllerText');
      ud.Handles.ControllerEdit = uicontrol('Parent',fig, ...
       'Unit',StdUnit, ...
         'BackgroundColor',[1 1 1], ...
       'Callback','nncontrolutil(''nnimport'',''editcallback'',gcbf);', ...
       'HorizontalAlignment','left', ...
       'ListboxTop',0, ...
       'Position',PointsToPixels*[383 98 125 20], ...
       'String','', ...
       'Style','edit', ...
        'UserData',EditUd,...
         'ToolTipStr','Controller object to be imported.',...
       'Tag','ControllerEdit');
      ud.Handles.ControllerButton = uicontrol('Parent',fig, ...
       'Unit',StdUnit, ...
       'Callback','nncontrolutil(''nnimport'',''buttoncallback'',gcbf);', ...
       'Position',PointsToPixels*[336 98 25 21], ...
       'String','-->', ...
        'UserData',ud.Handles.ControllerEdit,...
         'ToolTipStr','Select the network controller object to be imported.',...
       'Tag','ControllerButton');
    end
    h1 = uicontrol('Parent',fig, ...
     'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'HorizontalAlignment','left', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[383 67 70 22], ...
    'String','Plant', ...
    'Style','text', ...
      'Tag','PlantText');
   ud.Handles.PlantEdit = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',[1 1 1], ...
    'Callback','nncontrolutil(''nnimport'',''editcallback'',gcbf);', ...
    'HorizontalAlignment','left', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[383 53 125 20], ...
    'String','', ...
    'Style','edit', ...
     'UserData',EditUd,...
      'ToolTipStr','Plant object to be imported.',...
    'Tag','PlantEdit');
   ud.Handles.PlantButton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'Callback','nncontrolutil(''nnimport'',''buttoncallback'',gcbf);', ...
    'Position',PointsToPixels*[336 53 25 21], ...
    'String','-->', ...
     'UserData',ud.Handles.PlantEdit,...
      'ToolTipStr','Select the network plant object to be imported.',...
    'Tag','PlantButton');
   h1 = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'BackgroundColor',StdColor, ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[179 9 339 28], ...
    'Style','frame');
   ud.Handles.HelpButton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'Callback','nncontrolutil(''nnimport'',''windowstyle'',gcbf,''normal'');nncontrolutil(''nnimporthelp'',''main'',gcbf);', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[184 13 74 20], ...
    'String','Help', ...
      'ToolTipStr','Call the Import Network help window.',...
    'Tag','HelpButton');
   ud.Handles.CancelButton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'Callback','nncontrolutil(''nnimport'',''cancel'',gcbf);', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[435 13 74 20], ...
    'String','Cancel', ...
      'ToolTipStr','Discard the import action and close this menu',...
    'Tag','CancelButton');
   ud.Handles.OKButton = uicontrol('Parent',fig, ...
    'Unit',StdUnit, ...
    'Callback','nncontrolutil(''nnimport'',''apply'',gcbf);', ...
    'ListboxTop',0, ...
    'Position',PointsToPixels*[313 13 74 20], ...
    'String','OK', ...
      'ToolTipStr','Send the selected neural network to the Simulink model.',...
    'Tag','OKButton');

  end
   set(fig,'UserData',ud,'visible','on','WindowStyle','modal')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -