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

📄 fm_pcode.m

📁 电力系统的psat
💻 M
📖 第 1 页 / 共 2 页
字号:
function fig = fm_pcode(varargin)% FM_PCODE creates PSAT p-code archive%% FM_PCODE opens the GUI.% FM_PCODE(1) makes the p-code archive.%      The result is a file "psat-pcode-<x>.<x>.<x>.tar.gz"%      in the folder /home/fmilano/psat/archive%% Author:  Federico Milano% Date:    17-Jan-2003% Update:  22-Jan-2003% Update:  25-Jun-2003 (compliant to Matlab 6.5)% Update:  10-Aug-2003 (platform & Matlab version independent)% Version: 2.0.0%%E-mail:    fmilano@thunderbox.uwaterloo.ca%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2005 Federico Milano%% This toolbox is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2.0 of the License, or% (at your option) any later version.%% This toolbox is distributed in the hope that it will be useful, but% WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this toolbox; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,% USA.global Settings Themefigures = get(0,'Children');pcodefig = find(strcmp(get(figures,'filename'),'psatpcode'));if ~isempty(find(strcmp(get(figures,'filename'),'psatpcode'))) & ~nargin  figure(figures(pcodefig));  returnend% ===============================================================================if nargin == 0  h0 = figure('Color',Theme.color01, ...              'Units', 'normalized', ...              'Colormap',[], ...              'CreateFcn','', ...              'DeleteFcn','', ...              'FileName','psatpcode', ...              'KeyPressFcn','', ...              'MenuBar','none', ...              'Name','PSAT Archive', ...              'NumberTitle','off', ...              'PaperPosition',[18 180 576 432], ...              'PaperType','A4', ...              'PaperUnits','points', ...              'Position',sizefig(0.3,0.45), ...              'Resize','on', ...              'ToolBar','none', ...              'WindowButtonDownFcn','', ...              'WindowButtonMotionFcn','');  % Menu File  h1 = uimenu('Parent',h0, ...              'Label','File', ...              'Tag','MenuFile');  h2 = uimenu('Parent',h1, ...            'Callback','close(gcf)', ...              'Label','Exit', ...              'Tag','NetSett', ...              'Accelerator','x');  % Menu Run  h1 = uimenu('Parent',h0, ...              'Label','Run', ...              'Tag','MenuRun');  h2 = uimenu('Parent',h1, ...              'Callback','fm_pcode(1);', ...              'Label','Create Archive', ...              'Tag','OTV', ...              'Accelerator','a');  hlist = uicontrol('Parent',h0, ...                    'Units', 'normalized', ...                    'BackgroundColor',Theme.color11, ...                    'Enable','inactive', ...                    'ForegroundColor',Theme.color05, ...                    'HorizontalAlignment','left', ...                    'Min', 0, ...                    'Max', 2, ...                    'Position',[0.05, 0.32, 0.9, 0.60], ...                    'String',{'Push button to create p-code archive.','   '}, ...                    'Style','listbox', ...                    'Value',[], ...                    'FontName','lucida', ...                    'Tag','Listbox1');  hpush = uicontrol('Parent',h0, ...                    'Units', 'normalized', ...                    'BackgroundColor',Theme.color03, ...                    'Callback','fm_pcode(1);', ...                    'FontWeight','bold', ...                    'ForegroundColor',Theme.color09, ...                    'Position',[0.05, 0.1, 0.3, 0.08], ...                    'String','Archive', ...                    'Tag','Pushbutton1');  hpush = uicontrol('Parent',h0, ...                    'Units', 'normalized', ...                    'BackgroundColor',Theme.color03, ...                    'Callback','close(gcf)', ...                    'FontWeight','bold', ...                    'ForegroundColor',Theme.color09, ...                    'Position',[0.65, 0.1, 0.3, 0.08], ...                    'String','Close', ...                    'Tag','Pushbutton2');  x = 0.115;  if isunix, FontSize = 14; else, FontSize = 12; end  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color02, ...                 'ForegroundColor',Theme.color05, ...                 'FontName', 'helvetica', ...                 'FontSize', FontSize, ...                 'Position',[0.2-x 0.22 0.3 0.05], ...                 'HorizontalAlignment','right', ...                 'String', 'psat-pcode-', ...                 'Style','text', ...                 'Tag','StaticText1');  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color02, ...                 'ForegroundColor',Theme.color05, ...                 'FontName', 'helvetica', ...                 'FontSize', FontSize, ...                 'Position',[0.6-x 0.22 0.025 0.05], ...                 'String', '.', ...                 'Style','text', ...                 'Tag','StaticText1');  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color02, ...                 'ForegroundColor',Theme.color05, ...                 'FontName', 'helvetica', ...                 'FontSize', FontSize, ...                 'Position',[0.725-x 0.22 0.025 0.05], ...                 'String', '.', ...                 'Style','text', ...                 'Tag','StaticText1');  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color02, ...                 'ForegroundColor',Theme.color05, ...                 'FontName', 'helvetica', ...                 'FontSize', FontSize, ...                 'Position',[0.85-x 0.22 0.2 0.05], ...                 'HorizontalAlignment','left', ...                 'String', '.tar.gz', ...                 'Style','text', ...                 'Tag','StaticText1');  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color11, ...                 'Position',[0.5-x   0.22   0.1   0.05], ...                 'String','1', ...                 'Style','edit', ...                 'Tag','Edit1');  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color11, ...                 'Position',[0.625-x   0.22   0.1   0.05], ...                 'String','0', ...                 'Style','edit', ...                 'Tag','Edit2');  h1 = uicontrol('Parent',h0, ...                 'Units', 'normalized', ...                 'BackgroundColor',Theme.color11, ...                 'Position',[0.75-x   0.22   0.1   0.05], ...                 'String','0', ...                 'Style','edit', ...                 'Tag','Edit3');  h_bar = axes('position',[0.05  0.02 0.9 0.055]);  set(h_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 0 1e-3 1e-3],[0 1 1 0], ...             Theme.color08,'EdgeColor',[0 0 0],'EraseMode', ...             'none');  p2 = text(1e-3,0.5,[' ']);  set(p2, 'EraseMode','xor', ...          'HorizontalAlignment','left');  set(h0,'UserData',[p1 p2 hlist 1e-3]);  if nargout > 0, fig = h0; endelseif nargin == 1  if exist('fm_pcode') == 6    fm_choice('Current PSAT version is not a development distribution.',2)    pcodelist('============ n e w   a r c h i v e ============')    pcodelist('     ')    pcodelist('ERROR: Archive operations aborted!')    pcodelist('     ')    return  end  % get Matlab version  Ver = version;  pcodedir = ['pcode_',Ver(1),'p',Ver(3)];  hdl1 = findobj(gcf,'Tag','Edit1');  hdl2 = findobj(gcf,'Tag','Edit2');  hdl3 = findobj(gcf,'Tag','Edit3');  v1 = get(hdl1,'String');  v2 = get(hdl2,'String');  v3 = get(hdl3,'String');  d = pwd;  a = what('psat');  %psatfolder = strrep([a.path,'/'],filesep,'/');  psatfolder = [a.path,filesep];  % check for existence of an "archive" folder  cd(psatfolder)  a = dir;  if isempty(strmatch('archive',{a.name},'exact')),    [status,msg] = mkdir('archive')    if ~status, fm_disp(msg), end  end  cd([psatfolder,'archive'])  a = dir;  if isempty(strmatch(pcodedir,{a.name},'exact')),    [status,msg] = mkdir(pcodedir);    if ~status, fm_disp(msg), end  else    delallfiles(pcodedir)  end  cd(pcodedir)  a = dir;  if isempty(strmatch('psat',{a.name},'exact')),    [status,msg] = mkdir('psat');    if ~status, fm_disp(msg), end  else    delallfiles('psat')  end  % ===============================================================================  pcodelist('============ n e w   a r c h i v e ============')  pcodelist('    ')  pcodebar(5)  pcodelist('1. preparing ./psat/archive/pcode folder')

⌨️ 快捷键说明

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