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

📄 nefgui_i.m

📁 模糊神经网络采用matlab编程 o install NEFCON follow these steps: 1. Unpack the tar file NEFCON.TAR into your MA
💻 M
字号:
function nefgui_i(action, p1);  
  
%NEFGUI_I GUI-Tool to manage input preprocessing  
%
% See also NEFGUI_O, NEFGUI_E, NEFGUI and NEFCON.  
   
% Author: Andreas Nuernberger, TU Braunschweig, August 1996; a.nuernberger@tu-bs.de
%         contact: Ludger Merz, DASA-Airbus GmbH, Hamburg; ludger.merz@airbus.de
  
% Globals:    (shared by: nefcon nefgui ...)  
% NEFCON_STAT - Status of execution  
% NEFCON_UIH  - Handle to nefgui GUI-Tool  
% NEFCON_RULE - Selected rule generation  
% NEFCON_OPT  - Selected optimization method  
% NEFCON_FERR - Selected error calculation  
% NEFCON_RATE - Selected learning rate  
% NEFCON_IFM  - intial fismatrix (rule learning disabled)  
% NEFCON_EFM  - error fismatrix  
% NEFCON_EFMN - error fismatrix name  
% NEFCON_FIS  - nefcon fismatrix  
% NEFCON_NUMIN - number of inputs  
global NEFCON_PROT NEFCON_STAT NEFCON_UIH NEFCON_RULE NEFCON_OPT NEFCON_IFM NEFCON_EFM NEFCON_EFMN  
global NEFCON_RATE NEFCON_FERR NEFCON_FIS NEFCON_NUMIN  
global NEFCON_SYSNAME 
  
  
handle = findobj('Tag', 'NEFCONGUI_I');  
  
if nargin < 1  
    if handle == []  
        action = 'initialize';  
    else  
        action = '';  
    end;  
end;  
  
%create controls  
if strcmp(action, 'initialize') & handle == [],  
    % Information for all objects  
    bckfrmColor=230/255*[1 1 1];  
    frmColor=192/255*[1 1 1];  
    bckColor=230/255*[1 1 1];  
    btnColor=192/255*[1 1 1];  
    popupColor=192/255*[1 1 1];  
    editColor=255/255*[1 1 1];  
    border=6;  
    spacing=8;  
  
    %Calculate Windowsize  
    figPos=get(0,'DefaultFigurePosition');  
    figPos(3) = 0.7 * figPos(3);  
    figPos(4) = 0.7 * figPos(3);  
    maxRight=figPos(3);  
    maxTop=figPos(4);  
  
    % uicontrol sizes  
    btnWid = maxRight/4;  
    btnHt  = maxRight/18;  
  
    % calculate normalized units for resizeable window  
    Nborder = border/maxRight;  
    Nspacing= spacing/maxRight;  
    NbtnWid = btnWid/maxRight;  
    NbtnHt  = btnHt/maxTop;  
  
    % userdata  
    localdata = [];  
  
    % open new window  
    h = figure( ...  
        'Name','Input Preprocessing', ...  
        'NumberTitle','off', ...  
    	'Color',bckColor, ...  
	    'Visible','on', ...  
	    'UserData',localdata, ...  
    	'Units','pixels', ...  
	    'DefaultAxesXColor','black', ...  
    	'DefaultAxesYColor','black', ...  
    	'MenuBar','none', ...  
	    'Resize','on', ...  
	    'Position',figPos, ...  
    	'Nextplot','new', ...  
    	'Tag','NEFCONGUI_I' ...  
	    );  
    figPos=get(h,'position');  
  
    % create close button  
    closeb = uicontrol(h, ...  
        'Style', 'push', ...  
        'String', 'Close', ...  
    	'Units','normalized', ...  
        'Position', [1-Nspacing-NbtnWid Nspacing NbtnWid NbtnHt], ...  
        'CallBack', 'nefgui_i(''close'')');  
  
    % create help button  
    closeb = uicontrol(h, ...  
        'Style', 'push', ...  
        'String', 'Help', ...  
    	'Units','normalized', ...  
        'Position', [1-2*(Nspacing+NbtnWid) Nspacing NbtnWid NbtnHt], ...  
        'CallBack', 'hthelp(''nefcon.htm#inputpre'')');  
  
  
    % The Options frame  
    left    = Nspacing;  
    bottom  = 5*Nspacing + 3*NbtnHt;  
    width   = 1-2*Nspacing;  
    height  = 1-bottom-Nspacing;  
    right   = left+width;  
    top     = bottom+height;  
 
    topFrmHndl=uicontrol(h, ...   
        'Style','frame', ...   
       	'Units','normalized', ...   
        'Position', [left bottom+Nspacing width height-Nspacing], ...   
        'BackgroundColor',frmColor);   
  
    statHndl=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','center', ...  
        'Position', [left+Nspacing top-2*Nspacing-NbtnHt width-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Input related settings');  

    statHndl=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','left', ...  
        'Position', [left+Nspacing top-2*(Nspacing+NbtnHt)-2*Nspacing width/2-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Number of inputs:');  
  
    numinH=uicontrol(h, ...  
        'Style','edit', ...  
    	'BackgroundColor',editColor, ...  
        'Position', [left+width/2+Nspacing top-2*(Nspacing+NbtnHt)-2*Nspacing NbtnWid/2 NbtnHt], ...  
    	'Units', 'normalized',...  
        'CallBack', 'nefgui_i (''numin'')', ...  
    	'Tag','numin');   
 
    left    = 2*Nspacing;  
    bottom  = bottom + 2*Nspacing;  
    width   = 1-4*Nspacing;  
    height  = height - 3*Nspacing-3*NbtnHt;  
    right   = left+width;  
    top     = bottom+height;  
    topFrmHndl=uicontrol(h, ...   
        'Style','frame', ...   
       	'Units','normalized', ...   
        'Position', [left bottom width height], ...   
        'BackgroundColor',frmColor);   
 
    statHndl=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','left', ...  
        'Position', [left+Nspacing top-1*(Nspacing+NbtnHt) width/2-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Selected input');  
 
    instr = ['1|2|3|4|5|6|7|8|9']; 
    nofinH=uicontrol(h, ...   
        'Style','popup', ...   
    	'BackgroundColor',editColor, ...   
        'Position', [left+width/2+Nspacing top-1*(Nspacing+NbtnHt) NbtnWid/2 NbtnHt], ...   
    	'Units', 'normalized', ...   
        'CallBack', 'nefgui_i (''nofin'')', ...   
        'Tag', 'nofin');   
 
    lltH=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','left', ...  
        'Position', [left+Nspacing top-2*(Nspacing+NbtnHt) width/2-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Lower/Upper Limit:');  
    H=uicontrol(h, ...  
        'Style','edit', ...  
    	'BackgroundColor',editColor, ...  
        'Position', [left+width/2+Nspacing top-2*(Nspacing+NbtnHt) NbtnWid/2 NbtnHt], ...  
    	'Units', 'normalized',...  
        'CallBack', 'nefgui_i (''ll'')', ...  
    	'Tag','ll');   
  
    H=uicontrol(h, ...  
        'Style','edit', ...  
    	'BackgroundColor',editColor, ...  
        'Position', [left+width/2+Nspacing+NbtnWid top-2*(Nspacing+NbtnHt) NbtnWid/2 NbtnHt], ...  
    	'Units', 'normalized',...  
        'CallBack', 'nefgui_i (''ul'')', ...  
    	'Tag','ul');   
 
    H=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','left', ...  
        'Position', [left+Nspacing top-3*(Nspacing+NbtnHt) width/2-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Gain:');  
    H=uicontrol(h, ...  
        'Style','edit', ...  
    	'BackgroundColor',editColor, ...  
        'Position', [left+width/2+Nspacing top-3*(Nspacing+NbtnHt) NbtnWid/2 NbtnHt], ...  
    	'Units', 'normalized',...  
        'CallBack', 'nefgui_i (''gain'')', ...  
    	'Tag','gain');   
 
    left    = Nspacing;  
    bottom  = 2*Nspacing+NbtnHt;  
    width   = 1-2*Nspacing;  
    height  = 3*Nspacing+2*NbtnHt;  
    right   = left+width;  
    top     = bottom+height;  
    topFrmHndl=uicontrol(h, ...   
        'Style','frame', ...   
       	'Units','normalized', ...   
        'Position', [left bottom width height], ...   
        'BackgroundColor',frmColor);   
    statHndl=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','center', ...  
        'Position', [left+Nspacing top-NbtnHt-Nspacing width-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Output related settings');  
    H=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','left', ...  
        'Position', [left+Nspacing bottom+Nspacing width/2-2*Nspacing NbtnHt], ...  
    	'Units', 'normalized', ...  
        'String', 'Output gain:');  
    H=uicontrol(h, ...  
        'Style','edit', ...  
    	'BackgroundColor',editColor, ...  
        'Position', [left+width/2+Nspacing bottom+Nspacing NbtnWid/2 NbtnHt], ...  
    	'Units', 'normalized',...  
        'CallBack', 'nefgui_i (''ogain'')', ...  
    	'Tag','ogain');   

    % initialize 
    nefdef; 
    nefgui_i('actualize');  
 
elseif strcmp(action, 'actualize'),   
    instr = ['1|2|3|4|5|6|7|8|9']; 
    tagset(handle, 'nofin', 'String', instr(1,1:(2*NEFCON_NUMIN)-1));   
    tagset(handle, 'numin', 'String', int2str(NEFCON_NUMIN));   
 
    ll = get_param([NEFCON_SYSNAME,'/Fuzzi/Saturation1'],'Lower Limit'); 
    ul = get_param([NEFCON_SYSNAME,'/Fuzzi/Saturation1'],'Upper Limit'); 
    gain = get_param([NEFCON_SYSNAME,'/Fuzzi/GainIn1'],'Gain'); 
    ogain = get_param([NEFCON_SYSNAME,'/Fuzzi/GainOut'],'Gain'); 
    tagset(handle, 'ul', 'String', ul);   
    tagset(handle, 'll', 'String', ll);   
    tagset(handle, 'gain', 'String', gain);   
    tagset(handle, 'ogain', 'String', ogain);   
    tagset(handle, 'nofin', 'Value', 1);   
 
elseif strcmp(action, 'close'),  
    % close current nefgui_i  
    set(handle,'visible','off');  
%    close(gcf);  
  
elseif strcmp(action, 'numin'),  
    hndl=findobj(gcf, 'Tag', 'numin');  
    if hndl ~= [],  
        if NEFCON_STAT == 0,  
            tmp = str2num(get(hndl, 'String'));  
            if tmp == [],  
                disp('Not a number.');  
            elseif tmp < 1 | tmp > 10  
                disp('Illegal Value.');  
            else  
                NEFCON_NUMIN = tmp;  
                nofinH=findobj(gcf, 'Tag', 'nofin');  
                instr = ['1|2|3|4|5|6|7|8|9']; 
                set(nofinH, 'String', instr(1,1:(2*NEFCON_NUMIN)-1)); 
            end  
        else  
            disp('NEFCON: Could not change number of inputs during execution.');  
            set(hndl, 'String', int2str(NEFCON_NUMIN));  
        end  
    end  
    nefgui('nofinp');  
  
elseif strcmp(action, 'nofin'),  
    hndl=findobj(gcf, 'Tag', 'nofin');  
    if hndl ~= [],  
        tmp = num2str(get(hndl, 'Value'));   
        ll = get_param([NEFCON_SYSNAME,'/Fuzzi/Saturation', tmp],'Lower Limit'); 
        ul = get_param([NEFCON_SYSNAME,'/Fuzzi/Saturation', tmp],'Upper Limit'); 
        gain = get_param([NEFCON_SYSNAME,'/Fuzzi/GainIn', tmp],'Gain'); 
        tagset(handle, 'ul', 'String', ul);   
        tagset(handle, 'll', 'String', ll);   
        tagset(handle, 'gain', 'String', gain);   
    end 
 
elseif strcmp(action, 'll'),  
    hndl=findobj(gcf, 'Tag', 'll');  
    if hndl ~= [],  
        hn=findobj(gcf, 'Tag', 'nofin');  
        nof = num2str(get(hn, 'Value'));       
        if NEFCON_STAT == 0,  
            tmp = str2num(get(hndl, 'String'));  
            if tmp == [],  
                disp('Not a number.');  
            else  
%                NEFCON_NUMIN = tmp;  
                set_param([NEFCON_SYSNAME,'/Fuzzi/Saturation', nof],'Lower Limit',tmp); 
            end  
        else  
            disp('NEFCON: Could not change saturation during execution.');  
            ll = get_param([NEFCON_SYSNAME,'/Fuzzi/Saturation', nof],'Lower Limit'); 
            set(hndl, 'String', ll);  
        end  
    end 
     
elseif strcmp(action, 'ul'),  
    hndl=findobj(gcf, 'Tag', 'ul');  
    if hndl ~= [],  
        hn=findobj(gcf, 'Tag', 'nofin');  
        nof = num2str(get(hn, 'Value'));       
        if NEFCON_STAT == 0,  
            tmp = str2num(get(hndl, 'String'));  
            if tmp == [],  
                disp('Not a number.');  
            else  
                set_param([NEFCON_SYSNAME,'/Fuzzi/Saturation', nof],'Upper Limit',tmp); 
            end  
        else  
            disp('NEFCON: Could not change saturation during execution.');  
            ul = get_param([NEFCON_SYSNAME,'/Fuzzi/Saturation', nof],'Upper Limit'); 
            set(hndl, 'String', ul);  
        end  
    end 
 
elseif strcmp(action, 'gain'),  
    hndl=findobj(gcf, 'Tag', 'gain');  
    if hndl ~= [],  
        hn=findobj(gcf, 'Tag', 'nofin');  
        nof = num2str(get(hn, 'Value'));       
        if NEFCON_STAT == 0,  
            tmp = str2num(get(hndl, 'String'));  
            if tmp == [],  
                disp('Not a number.');  
            else  
                set_param([NEFCON_SYSNAME,'/Fuzzi/GainIn', nof],'Gain',tmp); 
            end  
        else  
            disp('NEFCON: Could not change saturation during execution.');  
            ul = get_param([NEFCON_SYSNAME,'/Fuzzi/GainIn', nof],'Gain'); 
            set(hndl, 'String', ul);  
        end  
    end 

elseif strcmp(action, 'ogain'),  
    hndl=findobj(gcf, 'Tag', 'ogain');  
    if hndl ~= [],  
        if NEFCON_STAT == 0,  
            tmp = str2num(get(hndl, 'String'));  
            if tmp == [],  
                disp('Not a number.');  
            else  
                set_param([NEFCON_SYSNAME,'/Fuzzi/GainOut'],'Gain',tmp); 
            end  
        else  
            disp('NEFCON: Could not change saturation during execution.');  
            ul = get_param([NEFCON_SYSNAME,'/Fuzzi/GainOut'],'Gain'); 
            set(hndl, 'String', ul);  
        end  
    end 
 
elseif strcmp(action, ''),  
    % popup window  
    nefgui_i('actualize');  
    set(handle,'visible','on');  
    figure(handle);  
else  
    disp(['nefgui_i: illegal action (' action ')']);  
end  
  

⌨️ 快捷键说明

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