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

📄 nefgui_c.m

📁 模糊神经网络采用matlab编程 o install NEFCON follow these steps: 1. Unpack the tar file NEFCON.TAR into your MA
💻 M
字号:
function nefgui_c(action, p1);   
%NEFGUI_C GUI-Tool to create NEFCON Fuzzy Controller and
%         Signal generator.
%  
% See also NEFGUI_O, NEFGUI_E, NEFGUI_I 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:  described in nefmat  
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_GEN NEFCON_CONTR  
   
handle = findobj('Tag', 'NEFCONGUI_C');   
   
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.4 * figPos(3);   
    maxRight=figPos(3);   
    maxTop=figPos(4);   
   
    % uicontrol sizes   
%    btnWid  = 110;   
%    btnHt   = 23;   
    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','Create Settings', ...   
        'NumberTitle','off', ...   
    	'Color',bckColor, ...   
	    'Visible','on', ...   
	    'UserData',localdata, ...   
    	'Units','pixels', ...   
	    'DefaultAxesXColor','black', ...   
    	'DefaultAxesYColor','black', ...   
    	'MenuBar','none', ...   
	    'Resize','on', ...   
    	'Nextplot','new', ...   
	    'Position',figPos, ...   
    	'Tag','NEFCONGUI_C' ...   
	    );   
    figPos=get(h,'position');   
   
    % create help button   
    closeb = uicontrol(h, ...   
        'Style', 'push', ...   
        'String', 'Help', ...   
    	'Units','normalized', ...   
        'Position', [1-1*(Nspacing+NbtnWid) Nspacing NbtnWid NbtnHt], ...   
        'CallBack', 'hthelp(''nefcon.htm#creaset'')');   
  
    % create close button   
    closeb = uicontrol(h, ...   
        'Style', 'push', ...   
        'String', 'Cancel', ...   
    	'Units','normalized', ...   
        'Position', [1-2*(Nspacing+NbtnWid)-Nspacing Nspacing NbtnWid NbtnHt], ...   
        'CallBack', 'nefgui_c(''close'')');   
   
    % create help button   
    closeb = uicontrol(h, ...   
        'Style', 'push', ...   
        'String', 'Ok', ...   
    	'Units','normalized', ...   
        'Position', [1-3*(Nspacing+NbtnWid)-Nspacing Nspacing NbtnWid NbtnHt], ...   
        'CallBack', ...  
            ['global NEFCON_NUMIN NEFCON_GEN NEFCON_CONTR;',...  
             'nefcrea(NEFCON_NUMIN,NEFCON_GEN, NEFCON_CONTR);', ...  
             'nefgui_c(''close'');']);   
   
    % The Options frame   
    left    = Nspacing;   
%    bottom  = 3*Nspacing+1*NbtnHt;   
    bottom  = 2*Nspacing + NbtnHt;   
    width   = 1-Nspacing;   
    height  = 1-bottom-Nspacing;   
    right   = left+width;   
    top     = bottom+height;   
   
    statHndl=uicontrol(h, ...   
        'Style','text', ...   
    	'BackgroundColor',bckfrmColor, ...   
	    'HorizontalAlignment','left', ...   
        'Position', [left+Nspacing top-Nspacing-NbtnHt width-2*Nspacing NbtnHt], ...   
    	'Units', 'normalized', ...   
        'String', 'System will be generated using...');   
   
    topFrmHndl=uicontrol(h, ...   
        'Style','frame', ...   
       	'Units','normalized', ...   
        'Position', [left bottom+Nspacing width height-2*Nspacing-NbtnHt], ...   
        'BackgroundColor',frmColor);   
   
    siggenH=uicontrol(h, ...   
        'Style','popup', ...   
    	'BackgroundColor',editColor, ...   
        'Position', [left+Nspacing top-3*Nspacing-2*NbtnHt width-2*Nspacing NbtnHt], ...   
    	'Units', 'normalized', ...   
        'String', 'Nefcon Signal Generator|Bounded Signal Generator|(none)',...   
        'CallBack', 'nefgui_c (''siggen'')', ...   
        'Tag', 'siggen');   
   
    neflH=uicontrol(h, ...   
        'Style','popup', ...   
    	'BackgroundColor',editColor, ...   
        'Position', [left+Nspacing top-5*Nspacing-3*NbtnHt width-2*Nspacing NbtnHt], ...   
    	'Units', 'normalized', ...   
        'String', 'Nefcon Learning System|Fuzzy Controller',...   
        'CallBack', 'nefgui_c (''nefl'')', ...   
        'Tag', 'nefl');   
 
    statHndl=uicontrol(h, ...  
        'Style','text', ...  
    	'BackgroundColor',frmColor, ...  
	    'HorizontalAlignment','left', ...  
        'Position', [left+Nspacing top-7*Nspacing-4*NbtnHt width*0.5-2*Nspacing NbtnHt], ...   
    	'Units', 'normalized', ...  
        'String', 'Number of inputs:');  
  
    numinH=uicontrol(h, ...  
        'Style','edit', ...  
    	'BackgroundColor',editColor, ...  
        'Position', [left+2*Nspacing+width*0.5 top-7*Nspacing-4*NbtnHt width*0.1 NbtnHt], ...   
    	'Units', 'normalized',...  
        'CallBack', 'nefgui_c (''numin'')', ...  
    	'Tag','numin');   
   
   
    % Setting global defaults - check if already set   
    nefdef;   
    nefgui_c('actualize');  
   
   
elseif strcmp(action, 'actualize'),   
    tagset(handle, 'siggen', 'Value', NEFCON_GEN); 
    tagset(handle, 'nefl', 'Value', NEFCON_CONTR); 
    tagset(handle, 'numin', 'String', int2str(NEFCON_NUMIN));   
 
elseif strcmp(action, 'close'),   
    % close current nefgui_c   
    set(handle,'visible','off');  
%    close(gcf);   
   
elseif strcmp(action, 'siggen'),   
    hndl=findobj(gcf, 'Tag', 'siggen');   
    if hndl ~= [],   
        NEFCON_GEN = get(hndl, 'Value');   
    end   
  
elseif strcmp(action, 'nefl'),   
    hndl=findobj(gcf, 'Tag', 'nefl');   
    if hndl ~= [],   
        NEFCON_CONTR = get(hndl, 'Value');   
    end   
   
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, ''),  
    % popup window  
    nefgui_c('actualize');  
    set(handle,'visible','on');  
    figure(handle);  
 
else   
    disp(['nefgui_c: illegal action (' action ')']);   
end   
   

⌨️ 快捷键说明

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