📄 nefoptf.m
字号:
function pc = nefoptf %NEFOPTF Signal editor of Bounded Signal Generator%% Modified version of OPTFIG.%% PC = NEFOPTF executes when the NCD Toolbox masked % outport block is double clicked. If the constraint figure % for the outport block is already displayed on the screen, % it is brought to the front. % The output PC is a string which will plot the Reference Signal % when evaluated in the base workspace. % % See also MENUNCD, CONTRNCD, MAKESURF. % Author(s): A. Potvin, 12-1-92 (Original OPTFIG)% Copyright (c) 1992-93 by The MathWorks, Inc. % $Revision: 1.14 $ $Date: 1993/11/01 17:59:12 $ % Modified: Andreas Nuernberger; DASA Airbus; June 1996 % Get current system and current block [sys,cb] = get_param; % Remark: OPT_STOP also tells db's when it's OK to change parameters global OPT_STOP OPT_STOP = []; % Create NCD figure if it's not already on screen %out = str2num(get_param([sys '/' cb],'Port')); out = 1; % Set the mask display so that matches Port number underneath %set_param([sys '/' cb],'Mask Display',['plot(t,y); ' int2str(out)]) %figname = ['System: ' sys ', Output: ' num2str(out)]; figname = ['System: ' sys '/' cb]; if figflag(figname), % If it is on screen, refresh it refresho; pc = ''; else % Initialize UserData and get font information ud = zeros(1,20); ud(1,2) = out; FontS = get(0,'DefaultTextFontSize'); comp = computer; fontinfo = [FontS+1 1.25*(FontS+2)]; if (comp(1:2)=='PC'), fontinfo(1) = 0.6*fontinfo(1); else fontinfo(1) = 0.55*fontinfo(1); end ud(1,13:14) = fontinfo; % GUI parameter % Set colormap and make figure if get(0,'ScreenDepth')==1, ColorMap = [0 0 0; 1 1 1]; else ColorMap = [1 0 0; 0 1 0]; % GUI parameter end fig = figure('Unit','norm','Pos',[.19 .3 .8 .5],'Name',figname, ... 'MenuBar','none','WindowButtonDownFcn','bdncd;', ... 'KeyPressFcn','keyncd;','Colormap',ColorMap,'NextPlot','new', ... 'UserData',ud,'Visible','off'); % Make uimenus %menuncd(fig,sys); s = uimenu(fig,'Label','Style'); uimenu(s,'Label','Grid','Call', ... ['if strcmp(get(get(gcf,''CurrentMenu''),''checked''),''off''),' ... ' set(get(gcf,''CurrentMenu''),''checked'',''on'');' ... ' set(gca,''XGrid'',''on'',''YGrid'',''on'');' ... 'else,' ... ' set(get(gcf,''CurrentMenu''),''checked'',''off'');' ... ' set(gca,''XGrid'',''off'',''YGrid'',''off'');' ... 'end']); sn = uimenu(s,'Label','Snap','Call', ... ['if strcmp(get(get(gcf,''CurrentMenu''),''checked''),''off''),' ... ' set(get(gcf,''CurrentMenu''),''checked'',''on'');' ... 'else,' ... ' set(get(gcf,''CurrentMenu''),''checked'',''off'');' ... 'end'],'Visible','off'); s = uimenu(fig,'Label','Help'); uimenu(s,'Label','Help',... 'Callback','hthelp(''nefcon.htm#nefsign'');'); ud(1,15) = sn; set(fig,'UserData',ud); % Make uicontrols %contrncd(fig,sys,cb,out); % Make pushbuttons itext1 = uicontrol(fig,'Style','frame','Units','norm', ... 'Pos',[0 0.001 0.998 .088]); SplitPBH = uicontrol(fig,'Style','pushbutton','String','Split', ... 'Unit','norm','Pos',[.35 .02 .10 .05],'Call','keyncd(83);'); HelpPBH = uicontrol(fig,'Style','pushbutton','String','Help', ... 'Unit','norm','Pos',[.7 .02 .10 .05], ... 'Call','hthelp(''nefcon.htm#nefsign'');'); DonePBH = uicontrol(fig,'Style','pushbutton', ... 'Unit','norm','Pos',[.85 .02 .10 .05],'Interrupt','no', ... 'String','Close','Call','close(gcf)'); NewPBH = uicontrol(fig,'Style','pushbutton', ... 'Unit','norm','Pos',[.55 .02 .10 .05],'Interrupt','no', ... 'String','New Signal', ... 'Call',['global NCD_UB NCD_LB NEFCON_SIGNAL RANGE_LIMIT;', ... 'NCD_UB=[]; NCD_LB=[]; NEFCON_SIGNAL=[];RANGE_LIMIT=[];', ... 'fig=gcf; ud = get(fig,''UserData''); ud(1,7:10) = neffilla(fig); set(fig,''UserData'',ud);', ... 'modsign(''init'');']); ChangeIntervPBH = uicontrol(fig,'Style','pushbutton', ... 'Unit','norm','Pos',[.25 .02 .05 .05],'Interrupt','no', ... 'String','Set', ... 'Call', ['set(gca, ''YLim'',eval(get(findobj(''Tag'', ''range''), ''String''), ''''));',... 'neffilla(gcf);']); RangeH = uicontrol(fig, ... 'Style','edit', ... 'HorizontalAlignment','left', ... 'Position',[.1 .02 .15 .05], ... 'Units', 'normalized',... 'Tag', 'range'); uicontrol(fig, ... 'Style','text', ... 'HorizontalAlignment','left', ... 'Position',[.02 .02 .07 .05], ... 'Units','normalized', ... 'Tag','rngtxt', ... 'String','Range:'); % 'BackgroundColor',editColor, ... % leave and set unvisible - don't no why it's used porttext = uicontrol(fig,'Style','text','Horiz','right', ... 'Units','norm','Pos',[.05 .02 .05 .05],'String','Port:', ... 'UserData',sys,'Call',cb,... 'visible', 'off'); text1edh = uicontrol(fig,'Style','edit','Horiz','left','Unit','norm', ... 'Pos',[.1 .02 .03 .05],'String',int2str(out),'Interruptible','yes', ... 'BackgroundColor','white','Call','texted;', ... 'visible', 'off'); ud(1,1) = text1edh; ud(1,6) = porttext; set(fig,'UserData',ud); % Make figure visible set(fig,'Vis','on') % Make axes ax = axes('Unit','norm','Pos',[.08 .2 .87 .75], ... 'CLim',[1 2],'NextPlot','new'); xlabel('Time (s)'); ylabel('Signal') ud = get(fig,'UserData'); ud(1,7:10) = neffilla(fig); set(fig,'UserData',ud); rang = get(gca, 'YLim'); set(RangeH, 'String', ['[' num2str(rang(1,1)) ' ' num2str(rang(1,2)) ']']); % Compile button functions if ud(1,7)~=0, % Just in case fillaxes returns an error keyncd(70); keyncd(78); end pc = updatdlg('nefoptf'); % Display Signal modsign('init'); end % flag % end optfig
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -