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

📄 f_guifigure.asv

📁 DSP程序 Matlab是一套用于科学工程计算的可视化高性能语言与软件环境。它集数值分析、矩阵运算、信号处理和图形显示于一体
💻 ASV
字号:
function [hfig,han,pos,colors] = f_guifigure (g_module,iplot)

%F_GUIFIGURE: Create figure window for specified GUI module
%
% Usage:   [hfig,han,pos,colors] = f_guifigure (g_module,iprint)
%
% Inputs: 
%          g_module = string containing name of GUI module
%          iplot    = optional integer.  When iplot creat a
%                     figure window that only shows the plot
%                     window (used by f_printmenu)
% Outputs:
%          hfig   = hand to figure window
%          han    = array of handles to tiled axes
%          pos    = array of position vectors for tiled axes
%          colors = array of plot colors
%
% See also: F_GUIPARMS

screen = get(0,'Screensize');
margin = 0.05;

if nargin < 2

% Create full figure    
    
hfig = figure('NumberTitle','off',...
              'Name',['GUI Module => ' g_module],...
              'MenuBar',menubar,...
              'Units','normalized',...
              'Position',[margin, margin, 1-2*margin, 1-2*margin]);
    
% Compute dimensions of tiled axes 

    dx = 0.06;
    dy = 0.05*screen(3)/screen(4);
    x1 = 0.5 - 1.5*dx;
    x2 = 0.25 - 1.25*dx;
    x3 = 1.0 - 2*dx;
    x4 = 0.5 - dx;
    y1 = 0.265 - 1.25*dy;
    y2 = 0.235 - 1.25*dy;
    y3 = 0.35 - 1.5*dy;
    y4 = 0.15 - dy;
    y5 = 0.5 - 2.0*dy;
    y6 = 0.23 - dy;
    pos = [dx,0.5+1.5*dy+y2,x1,y1
           dx,0.5+0.5*dy,x1,y2
           0.5+0.5*dx,0.5+1.5*dy+y4,x2,y3
           0.5+1.5*dx+x2,0.5+1.5*dy+y4,x2,y3
           0.5+0.5*dx,0.5+0.5*dy,x1,y4
           dx,dy,x3,y5
           dx,dy,x4,y5
           0.5,dy,x4,y5
           dx,.5-y6-dy,x3,y6
           dx,dy,x3,y6];
    n = size(pos,1);   
    white = [1 1 1];
    aspect = (pos(1,3)/pos(1,4))*(screen(3)/screen(4));

% Create tiled axes

    gmodule = f_cleanstring(g_module);
    for i = 1 : n
        han(i) = axes('Position',pos(i,:));
        axis ([0 1 0 1])
        if (i == 1) 
            colors = get(gca,'ColorOrder');
            axis ([0 1 0 1/aspect]);
        end        
        set (han(i),'Xtick',[])
        set (han(i),'Ytick',[])
        set (han(i),'Color',white)
        switch (i)
            case 1, text (0.5,1.08/aspect,gmodule,'HorizontalAlignment','center','Color',colors(1,:))
            case 2, text (0.5,1.10,'Edit parameters','HorizontalAlignment','center','Color',colors(2,:))
            case 3, text (0.5,1.05,'Select type','HorizontalAlignment','center','Color',colors(3,:))
            case 4, text (0.5,1.05,'Select view','HorizontalAlignment','center','Color',colors(3,:))
        end
        box on
    end

else           
    
% Create figure for plot window only    
    
    dx = 0.06;
    dy = 0.05*screen(3)/screen(4);
    hfig = figure('NumberTitle','off',...
                  'Name',['GUI Module => ' g_module],...
                  'MenuBar',menubar,...
                  'Units','normalized',...
                  'Position',[margin, margin, 1-2*margin, 0.5-2*dy-2*margin]);

% Compute dimensions of tiled axes 

    x1 = 0.5 - 1.5*dx;
    x2 = 0.25 - 1.25*dx;
    x3 = 1.0 - 2*dx;
    x4 = 0.5 - dx;
    y1 = 0;
    y2 = 0;
    y3 = 0;
    y4 = 0;
    y5 = 0.5 - 2.0*dy;
    y6 = 0.23 - dy;
    pos = [dx,dy,x1,y1
           dx,dy,x1,y2
           0.5+0.5*dx,dy,x2,y3
           0.5+1.5*dx+x2,dy,x2,y3
           0.5+0.5*dx,0.5+0.5*dy,x1,y4
           dx,dy,x3,y5
           dx,dy,x4,y5
           0.5,dy,x4,y5
           dx,.5-y6-dy,x3,y6
           dx,dy,x3,y6];
    n = size(pos,1);   
    white = [1 1 1];
    aspect = (pos(1,3)/pos(1,4))*(screen(3)/screen(4));

% Create tiled axes

    gmodule = f_cleanstring(g_module);
    for i = 1 : n
        han(i) = axes('Position',pos(i,:));
        axis ([0 1 0 1])
        if (i == 1) 
            colors = get(gca,'ColorOrder');
            axis ([0 1 0 1/aspect]);
        end        
        set (han(i),'Xtick',[])
        set (han(i),'Ytick',[])
        set (han(i),'Color',white)
        switch (i)
            case 1, text (0.5,1.08/aspect,gmodule,'HorizontalAlignment','center','Color',colors(1,:))
            case 2, text (0.5,1.10,'Edit parameters','HorizontalAlignment','center','Color',colors(2,:))
            case 3, text (0.5,1.05,'Select type','HorizontalAlignment','center','Color',colors(3,:))
            case 4, text (0.5,1.05,'Select view','HorizontalAlignment','center','Color',colors(3,:))
        end
        box on
    end
  
end

% Finalize

[q,matlab_version] = f_oldmat;
if matlab_version >= 7.0
    set (hfig,'DockControl','off')
end

⌨️ 快捷键说明

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