% Переменные
minw0=5e-6; maxw0=300e-6; w0=80e-6; 
minDz=-20e-2; maxDz=80e-2; Dz=0; 
minz=-50e-2; maxz=50e-2; z=16e-2;   
miny=-500e-6; maxy=500e-6; y=0; 
mind=0; maxd=2e-3; d=.8e-3; 
minFactor=0; maxFactor=1; Factor=1; 
minXmax=5e-5; maxXmax=10e-3; Xmax=15e-4; 
minFz=0; maxFz=15; Fz=10;

what=1; how=1;

% --------------------------------
windG1=figure;  figure(windG1);  %Там графики

set(windG1,'Color',[ 0 0 1]);
gbeam(w0,Dz, z, y, d, Factor, Xmax, Fz, what, how);

% --------------------------------
Change_button = uicontrol('Style','Pushbutton','Units','normalized',...
        'Position',[.91 .01 .1 .07],...
        'Callback','figure(windM1)','String','Меню'); %Кнопка выхода в меню%

% --------------------------------
windM1=figure;  %Там меню с органами управления 
figure(windM1);  % Окно с будущим меню на передний план

ctl_ini;  %Инициализация 
captionM = 'Gauss Beam Investigation';

% --------------------------------
Ctrl1='on';  captnPar1 ='W0';
popup1Val =1; popup1Opts='Radius|W(z)|Summary Power|Power +intfr'; 
Slider1Min=minw0; Slider1Max=maxw0; Slider1Val=w0;

% --------------------------------
Ctrl2='on'; captnPar2 ='Necks Dist.';
popup2Val =1; popup2Opts='2D plots|3D plot'; 
Slider2Min=minDz; Slider2Max=maxDz; Slider2Val=Dz;

% --------------------------------
Ctrl3='on'; captnPar3 ='Z of view';
Slider3Min=minz; Slider3Max=maxz; Slider3Val=z;

% --------------------------------
Ctrl4='on'; captnPar4 ='Y Distance';
Slider4Min=miny; Slider4Max=maxy; Slider4Val=y;

% --------------------------------
Ctrl5='on';  captnPar5 ='Clearance D';
Slider5Min=mind; Slider5Max=maxd; Slider5Val=d;

% --------------------------------
Ctrl6='on';  captnPar6 ='A1/A0 Factor';
Slider6Min=minFactor; Slider6Max=maxFactor; Slider6Val=Factor;

% --------------------------------
Ctrl7='on';  captnPar7 ='X*Y range';
Slider7Min=minXmax; Slider7Max=maxXmax; Slider7Val=Xmax;

% --------------------------------
Ctrl8='on';  captnPar8 ='Z/Z0 Factor';
Slider8Min=minFz; Slider8Max=maxFz; Slider8Val=Fz;

% --------------------------------
UActionCheck=['w0= Edit1Val; Dz= Edit2Val;'...
              'z= Edit3Val; y= Edit4Val;'...
              'd= Edit5Val; Factor= Edit6Val;'...
              'Xmax= Edit7Val; Fz= Edit8Val;'...
              'what= popup1Val; how= popup2Val;'... 
	      'figure(windG1);'...
	      'gbeam(w0,Dz, z, y, d, Factor, Xmax, Fz, what, how);'...
	     ];	

% =================================
ctlgra00;  % В окно - меню органов управления


