📄 nndataimport.m
字号:
function nndataimport(cmd,arg1,arg2,arg3)
%NNDATAIMPORT Data Import GUI for the Neural Network Controller Toolbox.
%
% Synopsis
%
% nndataimport(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:10:49 $
% CONSTANTS
me = 'Import Data.';
% DEFAULTS
if nargin == 0, cmd = ''; else cmd = lower(cmd); end
% FIND WINDOW IF IT EXISTS
fig=findall(0,'type','figure','name',me);
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;
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 215], ...
'Tag','ImportIACfig', ...
'WindowStyle','modal');
h1 = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Position',PointsToPixels*[11 9 165 125], ...
'Style','frame');
h1 = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Position',PointsToPixels*[11 142 165 55], ...
'Style','frame');
h1 = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Position',PointsToPixels*[54 120 81 20], ...
'String','Import From:', ...
'Style','text');
h1 = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Position',PointsToPixels*[49 182 91 20], ...
'String','Type of Data:', ...
'Style','text');
ud.Handles.Sbutton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Callback','nncontrolutil(''nndataimport'',''radiobutton1'',gcbf);nncontrolutil(''nndataimport'',''structures'',gcbf);', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[20 167 100 19], ...
'String','Structures', ...
'Style','radiobutton', ...
'ToolTipStr','If selected, the data will be expected in structure form (e.g., tr_dat.U and tr_dat.Y).',...
'Tag','Mbutton',...
'Value',1);
ud.Handles.Abutton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Callback','nncontrolutil(''nndataimport'',''radiobutton1'',gcbf);nncontrolutil(''nndataimport'',''arrays'',gcbf);', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[20 144 100 19], ...
'String','Arrays', ...
'Style','radiobutton', ...
'Tag','Wbutton', ...
'ToolTipStr','If selected, the data will be expected in array form - one for input and one for output.');
set(ud.Handles.Abutton,'UserData',[ud.Handles.Sbutton]);
set(ud.Handles.Sbutton,'UserData',[ud.Handles.Abutton]);
ud.Handles.Wbutton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Callback','nncontrolutil(''nndataimport'',''radiobutton'',gcbf);nncontrolutil(''nndataimport'',''workspace'',gcbf);', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[20 105 100 19], ...
'String','Workspace', ...
'Style','radiobutton', ...
'Tag','Wbutton', ...
'ToolTipStr','If selected, the data will be taken from the MATLAB workspace.',...
'Value',1);
ud.Handles.Mbutton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'Callback','nncontrolutil(''nndataimport'',''radiobutton'',gcbf);nncontrolutil(''nndataimport'',''matfile'',gcbf);', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[20 81 100 19], ...
'String','MAT-file', ...
'Style','radiobutton', ...
'ToolTipStr','If selected, the data 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 58 141 20], ...
'String','MAT-filename:', ...
'Style','text', ...
'ToolTipStr','Enter the name of the MAT-file containing the data.',...
'Tag','FileNameText');
ud.Handles.FileNameEdit = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',[1 1 1], ...
'Enable','off', ...
'Callback','nncontrolutil(''nndataimport'',''clearpath'',gcbf);nncontrolutil(''nndataimport'',''matfile'',gcbf);', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[20 39 141 20], ...
'String','', ...
'Style','edit', ...
'ToolTipStr','Enter the name of the MAT-file containing the data.',...
'Tag','FileNameEdit');
ud.Handles.BrowseButton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'Enable','off', ...
'Callback','nncontrolutil(''nndataimport'',''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 153], ...
'Style','frame');
ud.Handles.ModelText = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'ListboxTop',0, ...
'Position',PointsToPixels*[193 184 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 139], ...
'Style','listbox', ...
'Tag','ModelList', ...
'ToolTipStr','Present the data 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 153], ...
'Style','frame');
h1 = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'ListboxTop',0, ...
'Position',PointsToPixels*[379 184 130 20], ...
'String','Input Output Variables', ...
'Style','text');
EditUd = struct('ListIndex',0,'String','');
ud.Handles.DataText = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[383 153 120 22], ...
'String','Structure Name:', ...
'Style','text', ...
'Tag','DataText');
ud.Handles.DataEdit = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',[1 1 1], ...
'Callback','nncontrolutil(''nndataimport'',''editcallback'',gcbf);', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[383 139 125 20], ...
'String','', ...
'Style','edit', ...
'UserData',EditUd,...
'ToolTipStr','Data object to be imported.',...
'Tag','DataEdit');
ud.Handles.DataButton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'Callback','nncontrolutil(''nndataimport'',''buttoncallback'',gcbf);', ...
'Position',PointsToPixels*[336 139 25 21], ...
'String','-->', ...
'UserData',ud.Handles.DataEdit,...
'ToolTipStr','Select the data object to be imported.',...
'Tag','DataButton');
ud.Handles.InputText = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[383 110 70 22], ...
'String','Input Array:', ...
'Style','text', ...
'Tag','InputText');
ud.Handles.InputEdit = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',[1 1 1], ...
'Callback','nncontrolutil(''nndataimport'',''editcallback'',gcbf);', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[383 96 125 20], ...
'String','', ...
'Style','edit', ...
'UserData',EditUd,...
'ToolTipStr','Input data array to be imported.',...
'Tag','InputEdit');
ud.Handles.InputButton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'Callback','nncontrolutil(''nndataimport'',''buttoncallback'',gcbf);', ...
'Position',PointsToPixels*[336 96 25 21], ...
'String','-->', ...
'UserData',ud.Handles.InputEdit,...
'ToolTipStr','Select the input array to be imported.',...
'Tag','InputButton');
ud.Handles.OutputText = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',StdColor, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[383 67 70 22], ...
'String','Output Array:', ...
'Style','text', ...
'Tag','OutputText');
ud.Handles.OutputEdit = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'BackgroundColor',[1 1 1], ...
'Callback','nncontrolutil(''nndataimport'',''editcallback'',gcbf);', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[383 53 125 20], ...
'String','', ...
'Style','edit', ...
'UserData',EditUd,...
'ToolTipStr','Output data array to be imported.',...
'Tag','OutputEdit');
ud.Handles.OutputButton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'Callback','nncontrolutil(''nndataimport'',''buttoncallback'',gcbf);', ...
'Position',PointsToPixels*[336 53 25 21], ...
'String','-->', ...
'UserData',ud.Handles.OutputEdit,...
'ToolTipStr','Select the output array to be imported.',...
'Tag','OutputButton');
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(''nndataimport'',''windowstyle'',gcbf,''normal'');nncontrolutil(''nndataimporthelp'',''main'',gcbf);', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[184 13 74 20], ...
'String','Help', ...
'ToolTipStr','Call the Import Data help window.',...
'Tag','HelpButton');
ud.Handles.CancelButton = uicontrol('Parent',fig, ...
'Unit',StdUnit, ...
'Callback','nncontrolutil(''nndataimport'',''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(''nndataimport'',''apply'',gcbf);', ...
'ListboxTop',0, ...
'Position',PointsToPixels*[313 13 74 20], ...
'String','OK', ...
'ToolTipStr','Import the data into the Plant Identification window.',...
'Tag','OKButton');
end
set(fig,'UserData',ud,'visible','on','WindowStyle','modal')
nncontrolutil('nndataimport','structures',gcbf);
nncontrolutil('nndataimport','workspace',gcbf);
elseif strcmp(cmd,'cancel')
H=get(ud.Handles.parent,'userdata');
arg1=get(H.gcbh_ptr,'userdata');
arg2=get(H.gcb_ptr,'userdata');
if strcmp('ref',ud.Handles.type_net)
nnmodref('',arg1,arg2,'');
else
nnident('',arg1,arg2,'');
end
delete(fig)
return;
elseif strcmp(cmd,'windowstyle')
set(fig,'visible','on','WindowStyle',arg2)
return;
elseif strcmp(cmd,'radiobutton')
val = get(gcbo,'Value');
sibs = get(gcbo,'UserData');
if ~val,
set(gcbo,'Value',1);
elseif val==1,
set(sibs,'Value',0);
set(ud.Handles.FileNameEdit,'String','', ...
'UserData',struct('FileName',[],'PathName',[]));
set(ud.Handles.DataEdit,'String','','UserData',...
struct('ListIndex',0,'String',''));
set(ud.Handles.InputEdit,'String','','UserData',...
struct('ListIndex',0,'String',''));
set(ud.Handles.OutputEdit,'String','','UserData',...
struct('ListIndex',0,'String',''));
end % if/else val
elseif strcmp(cmd,'radiobutton1')
val = get(gcbo,'Value');
sibs = get(gcbo,'UserData');
if ~val,
set(gcbo,'Value',1);
elseif val==1,
set(sibs,'Value',0);
% set(ud.Handles.DataEdit,'String','','UserData',...
% struct('ListIndex',0,'String',''));
% set(ud.Handles.InputEdit,'String','','UserData',...
% struct('ListIndex',0,'String',''));
% set(ud.Handles.OutputEdit,'String','','UserData',...
% struct('ListIndex',0,'String',''));
end % if/else val
elseif strcmp(cmd,'arrays') | strcmp(cmd,'structures'),
if strcmp(cmd,'arrays')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -