%Ventana principal
figure( ...
	'Name','MECDI: Programa de análisis del motor Diesel de inyección directa ','Units','normalized','resize','off',...
	 'menubar','none','position',[0 .06 1 .85],'Color',[0 .8 .7], ...
       'NumberTitle','off');
      men0=uimenu('Label','Archivo');
      men1=uimenu('Label','Ayuda');

    ejes=axes( ...
	'Units','normalized',...
      'FontName','times','fontsize',8, 'Position',[.10 .47 .45 .45]);

    %===================================
    top=0.35;
    left=0.04;
    right=0.75;
    bottom=0.05;
    labelHt=0.05;
    spacing=0.005;
    frmBorder=0.02;
    frmPos=[left-frmBorder bottom-frmBorder ...
	(right-left)+2*frmBorder (top-bottom)+2*frmBorder];  

    %Zona de mensajes
    mcwPos=[left bottom (right-left) .035];
    textome=uicontrol( ...
	     'Style','text', ...
        'Units','normalized', ...
        'Max',10,'HorizontalAlignment','center', ...
        'BackgroundColor',[1 1 1], ...
        'Position',mcwPos, ...
        'String','Seleccione un valor para las variables rpm, EGR y Carga');

    %Marco inferior
    uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',frmPos, ...
	     'BackgroundColor',[.5 .5 .6]);
  
    %Título del marco inferior	
    labelPos=[left top-.03 right-left .03];
    uicontrol( ...
	 'Style','text', ...
        'Units','normalized', ...
        'Position',labelPos, ...
        'BackgroundColor',[.4 .4 .6], ...
	     'ForegroundColor',[1 1 1], ...
        'String','Variables');

    %====================================
    %Barra de deslizamiento y etiquetas para rpm	
    btnPos=[.12 .13 .02 .15]; 
    Hc_41=uicontrol( ...
	  'Style','Slider', ...
        'Units','normalized', ...
        'Position',btnPos,'value',ralenti,...
        'Min',ralenti,'Max',5000);
       
    btnPos=[.07 .21 .04 .03];
    uicontrol(...
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',btnPos,'string','RPM:');
    texto1=uicontrol(...
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',[.06 .17 .05 .03],'string',num2str(get(Hc_41,'value')));
    %====================================
    %Barra de deslizamiento para EGR	
    btnPos=[.24 .13 .02 .15];
    Hc_42=uicontrol( ...
	  'Style','Slider', ...
        'Units','normalized', ...
        'Position',btnPos,'Value',0,...
        'Min',0,'Max',20);
    btnPos=[.16 .21 .07 .03];
    uicontrol(... 
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',btnPos,'string','EGR(%):');
    texto2=uicontrol(...
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',[.16 .17 .07 .03],'string',num2str(get(Hc_42,'value')));
    %====================================
    %Barra de deslizamiento para la Carga	
    btnPos=[.36 .13 .02 .15];
    Hc_43=uicontrol( ...
       'Style','Slider', ...
       'sliderstep',[0.05 0.1],...
        'Units','normalized', ...
        'Position',btnPos,'Value',0);
    btnPos=[.26 .21 .10 .03];
    uicontrol(... 
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',btnPos,'string','Carga(%):');
    texto3=uicontrol(...
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',[.28 .17 .07 .03],'string',num2str(get(Hc_43,'value')));
    %====================================
    %Barra ángulo de inyección	
    btnPos=[.48 .13 .02 .15];
    Hc_43a=uicontrol( ...
       'Style','Slider', ...
        'Units','normalized', ...
        'Position',btnPos,'Value',-25);
    btnPos=[.38 .21 .10 .03];
    uicontrol(... 
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',btnPos,'string','inyección(º):');
    texto4=uicontrol(...
        'Style','text','HorizontalAlignment','center', ...
        'Units','normalized','BackgroundColor',[.5 .5 .6],...
        'Position',[.40 .17 .07 .03],'string',num2str(get(Hc_43a,'value')));
    %====================================
    %Botón ACEPTAR   
    btnPos=[left+.513 .21 .15 .08];
    Hc_56=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',btnPos, ...
        'String','ACEPTAR');
    %Tanto por ciento de programa ejecutado
    Hc_67=uicontrol(...
        'style','text',...
        'Units','normalized',...
        'position',[.55 .14 .1 .03],...
        'HorizontalAlignment','left', ...
        'string','completado:');
    completado=uicontrol(...
        'style','text',...
        'Units','normalized',...
        'position',[.65 .14 .03 .03],...
        'HorizontalAlignment','right', ...
        'string','0');
    Hc_68=uicontrol(...
        'style','text',...
        'Units','normalized',...
        'position',[.68 .14 .02 .03],...
        'HorizontalAlignment','left', ...
        'string','%');
    %====================================
    %Información para todos los botones
    labelColor=[0.8 0.8 0.8];
    top=0.97;
    btnWid=0.15;
    btnHt=0.08;
    spacing=0.02;
    frmBorder=0.02;
    bottom=.03;
    yPos=0.05-frmBorder;
    marc=.01;
    left=1-btnWid-2*frmBorder-marc;
    %====================================
    %Marco inferior derecho
    frmPos=[left bottom btnWid+2*frmBorder 1-top+2*btnHt+spacing+.051-bottom];
    uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',frmPos, ...
	  'BackgroundColor',[0.5 0.5 0.6]);

    %Marco superior derecho
    yPos=1-top+2*btnHt+spacing+.053;
    frmPos=[left yPos btnWid+2*frmBorder 2*frmBorder+8*btnHt+7*spacing];
    uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',frmPos, ...
        'BackgroundColor',[0.5 0.5 0.6]);
    %====================================
    % Gráficos
    btnNumber=1;
    Hc_57=uicontrol( ...
	     'Style','text', ...
        'Units','normalized', ...
        'Position',[.82 .93 .15 .04], ...
        'background',[.5 .5 .6],...
        'String','GRÁFICOS');
    %====================================
    % P-O
    btnNumber=1;
    Hc_57=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .86 .15 .06], ...
        'String','Presión');

    %====================================
    % P-V
    btnNumber=2;
    Hc_58=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .79 .15 .06], ...
        'String','P-V');

    %====================================
    % T-O
    btnNumber=3;
    Hc_59=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .72 .15 .06], ...
        'String','P-V (log)');

    %====================================
    % Qr-O
    btnNumber=4;
    Hc_60=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .65 .15 .06], ...
        'String','Temperatura');
    %====================================
    % X-O
    btnNumber=5;
    Hc_61=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .58 .15 .06], ...
        'String','T. C. L.');

    %====================================
    % Transferencia de calor
    btnNumber=6;
    Hc_62=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.82 .51 .15 .06], ...
        'String','Energía');
    %====================================
    % Transf. calor
    btnNumber=7;
    Hc_63=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .44 .15 .06], ...
        'String','Transf. calor');
    %====================================
    % Masa cilindro
    btnNumber=7;
    Hc_70=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .37 .15 .06], ...
        'String','Masa');
    %====================================
    % gammma
    btnNumber=7;
    Hc_71=uicontrol( ...
	     'Style','pushbutton', ...
        'Units','normalized', ...
        'Position',[.82 .30 .15 .06], ...
        'String','Gamma');
    %====================================
    % botón ÁNALISIS
    Hc_64a=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.82 .18 .15 .06], ...
        'String','ÁNALISIS');
    %====================================
    % botón NUEVO
    Hc_64=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.82 .11 .15 .06], ...
        'String','NUEVO');
    %====================================
    %Botón CERRAR
    Hc_65=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.82 .04 .15 .06], ...
        'String','CERRAR');
   
    %===================================           
    % Zoom
    Hc_66=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.6 .8 .15 .1], ...
        'String','ZOOM');
    %===================================           
    % Párametros iniciales
    Hc_69=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.6 .65 .15 .1], ...
        'String','PARÁMETROS');
    %===================================           
    % Resultados
    Hc_72=uicontrol( ...
	 'Style','push', ...
        'Units','normalized', ...
        'Position',[.6 .5 .15 .1], ...
        'String','RESULTADOS');
    %===================================
    
   
    
           