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

📄 fm_bar.m

📁 这是一个很适合研究和学习用的电力系统仿真软件
💻 M
字号:
function fm_bar(command)
% FM_BAR draws PSAT status bar
%
% FM_BAR(COMMAND)
%
%see also FM_MAIN
%
%Author:    Federico Milano
%Date:      25-Feb-2004
%Version:   1.0.0
%
%E-mail:    fmilano@thunderbox.uwaterloo.ca
%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano

global Hdl Fig Theme
persistent p1 p2

if ~Fig.main, return, end

if isnumeric(command)
  x1 = command(1);
  x2 = command(2);
  if x1 > 0.95
    command = 'drawend';
  else
    command = 'draw';
  end
  x1 = 0.01+x1*0.98;
  x2 = 0.01+x2*0.98;
end

switch command
 case 'open'

  set(Fig.main,'Pointer','watch')
  set(0,'CurrentFigure',Fig.main);
  set(Hdl.text,'Visible','off');
  set(Hdl.frame,'Visible','off');
  if Hdl.bar ~= 0, delete(Hdl.bar), end
  Hdl.bar = axes('position',[0.04064 0.0358 0.9212 0.04361], ...
                 'box','on');

  set(Hdl.bar, ...
      'Drawmode','fast', ...
      'NextPlot','add', ...
      'Color',[0.9 0.9 0.9], ...
      'Xlim',[0 1], ...
      'Ylim',[0 1], ...
      'Box','on', ...
      'XTick',[], ...
      'YTick',[], ...
      'XTickLabel','', ...
      'YTickLabel','');
  %p1 = patch([0.01 0.01 0.01+1e-5 0.01+1e-5],[0.25 0.75 0.75 0.25], ...
  %           Theme.color08,'EdgeColor',Theme.color08,'EraseMode','none');
  p1 = fill([0.01 0.01 0.01+1e-5 0.01+1e-5],[0.25 0.75 0.75 0.25], ...
             Theme.color08,'EdgeColor',Theme.color08,'EraseMode','none');
  p2 = text(1e-5,0.35,[' ',num2str(round(1e-5*100)),'%']);
  set(p2,'EraseMode','xor','HorizontalAlignment','left');
  drawnow

 case 'draw'

  set(p2,'Position',[x1, 0.35, 0], ...
      'String',[' ',num2str(round(x1*100)),'%']);
  set(p2,'Position',[x2, 0.35, 0], ...
      'String',[' ',num2str(round(x2*100)),'%']);
  set(p1,'XData',[0.01, 0.01, x2, x2]);
  drawnow

 case 'drawend'

  set(p2,'Position',[x1, 0.35, 0], ...
         'String',[' ',num2str(round(x1*100)),'%']);
  set(p2,'HorizontalAlignment','right');
  set(p1,'XData',[x1, x1, x2, x2]);
  set(p2,'Position',[x2, 0.35, 0], ...
         'String',[' ',num2str(round(x2*100)),'%']);
  drawnow

 case 'close'

  set(Fig.main,'Pointer','arrow');
  delete(Hdl.bar);
  Hdl.bar = 0;
  set(Hdl.frame,'Visible','on');
  set(Hdl.text,'Visible','on');
  clear p1 p2

end

⌨️ 快捷键说明

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