ga_init2.m

来自「MATLAB遗传代码的源码 具体如何使用?希望能受到指点」· M 代码 · 共 116 行

M
116
字号
%
%
%                        Tree Structured GA
%
% going back to a slightly different screen
%
main=figure('Number','Off',...
        'Name','Genetic Programming Algorithm for Steady-State System Identification',...
        'Menubar','None',...
        'Resize','off',...
        'Units','Pixels',...
        'Position',[2 2 636 455]);

%
% Use a push button (without callback, i.e. inactive) for text title
%
datitle_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 390 500 25],...
        'String','Genetic Programming Algorithm for Steady-State System Identification');

datinn_rb = uicontrol(main,...
        'enable','off',...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 365 500 25],...
        'String','Data loaded Sucessfully:   ');
%
% Choose the input-output combination
%
datwho_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 340 250 25],...
        'String','Choose Input Output Data Combination',...
        'Callback',[...
        'if data_loaded == 1;',...
                'ga_selec;',...
                'data_comb=1;',...
        'else;',...
                'dialog(''style'',''error'',''replace'',''on'',''resize'',''off'',''name'',''Error'',''Textstring'',e2);',...
        'end;']);

datlok_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[300 340 250 25],...
        'String','Plot the data',...
        'Callback',[...
                'if data_loaded == 1;',...
                'ga_view1;',...
                'gobck;',...
                'else;',...
                'dialog(''style'',''error'',''replace'',''on'',''resize'',''off'',''name'',''Error'',''Textstring'',e1);',...           
                'end;']);

gainit_rb = uicontrol(main,...
        'Style','Push',...
        'BackgroundColor',[0 0 1],...
        'ForegroundColor','y',...
        'units','Pixels',...
        'Position',[50 315 250 25],...
        'String','Initialise the GA',...
        'Callback',[...
        'if data_loaded == 1 & data_comb == 1 & sum(output_var) > 0;'...
                'ga_ini;',...
        'else;',...
                'dialog(''style'',''error'',''replace'',''on'',''resize'',''off'',''name'',''Error'',''Textstring'',e3);',...   
        'end;']);

closebtn=uicontrol(gcf,'Style','Push',...
        'Position',[300 315 250 25],...
        'String','Close',...
        'Callback',[...
        'close(gcf);',...
        'clear all;']);

%
% Set up error strings
%

%
% No data loaded #1
%
e1=['         You have not loaded any  data'
   '         into the programme yet.  This'
   '         means  that  analysing it  is'
   '         going to be tricky ....      '];    

%
% No data loaded #2
%
e2=['         You have not loaded any  data'
   '         into the programme yet.  This'
   '         means  that  choosing a      '
   '         combination is going to be   '
   '         tricky ....                  '];    
%
% No data or No combination

e3=['         You have not loaded any  data '
   '         into the programme or you have'
   '         not chosen the I/O combination'
   '         or no output is specified     '];    

        

⌨️ 快捷键说明

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