📄 plot_proc.m
字号:
%plot_proc is used to change properties of a user selected curves
%
% plot_proc(nTask,arg1,arg2)
%where
% nTask -- curve manipulation code
% 1 display dialog box for preference
% 2 select background color
% 3 select axis color
% 4 select plot color
% 5 change the properties of plots
% 6 for set defaults specifications
% arg1 -- invoke the curv_proc function
% arg2 -- invoke the zoom_proc function
%
%The functions available in the module are
%
% property_box -- create a dialog box for changing
% chg_plt_property -- change the properties of selected objects
% curv_proc -- change properties of a user selected curve.
% zoom_proc -- changes the zooming facility
%
%Copyright (c) 1997-1999 by Professor Dingyu Xue
%School of Information Science and Engineering, Northeastern University
%Shenyang 110006, P R China
%Email: xue_dy@hotmail.com
%
%This module is used only with CtrlLAB.
%-------------------------------------------------------------------------
function plot_proc(nTask, arg1, arg2)
switch nargin
case 1
uu=get(gcf,'UserData');
if any([2,3,4,6]==nTask), bbCtrl=uu{1}; end
switch nTask
case 1, property_box;
case 2, set(bbCtrl(8),'UserData',uisetcolor);
case 3, set(bbCtrl(10),'UserData',uisetcolor);
case 4, set(bbCtrl(16),'UserData',uisetcolor);
case 5, chg_plt_property;
case 6
extra_funs(4,1,'Value',[1,4,6],[2,3,5]); set(bbCtrl(6),'UserData',0.8*[1,1,1]);
set(bbCtrl(10),'UserData',[0,0,0]); set(bbCtrl(16),'UserData',[1,1,1]);
case 7, extra_funs(4,1,'Value',11,12); ctrllab(6,5);
case 8, extra_funs(4,1,'Value',12,11); ctrllab(6,6);
case 9, ctrllab(3,5);
case 10, ctrllab(3,6);
end
case 2, curv_proc(nTask); %call curve processing routine
case 3, zoom_proc(nTask); %call the zooming mode processing routine
end
%---------------------------------------------------------------------------------
%property_box is used to create a dialog box for changing the properties of plots.
%---------------------------------------------------------------------------------
function property_box()
g_0=gcf; uu=get(g_0,'UserData'); g_main=findobj('Tag','CtrlLABMain');
if length(g_main)>0,
figure(g_main);
vvv=extra_funs(5,4,'Checked',24:27,[]); vv=zeros(1,4); vv(vvv)=1;
end
g_win=findobj('Tag','CtrlLABPltPref');
if length(g_win)==0
%if the graphics properties window does not exist create a new one
g_win=figure('Units','normalized','Position',[0.2425 0.232 0.5 0.45],...
'NumberTitle','off','Name','Plot Preference Options',...
'MenuBar','none','Color',0.8*[1,1,1],...
'Tag','CtrlLABPltPref','Resize','off');
extra_funs(1);
% Define Grid on/off
[v,d]=version; v1=eval(v(1)); v2=eval(v(3)); v3=eval(v(5));
if v2==2 & v3==0, strRadio='ToggleButton'; strCheck=strRadio;
else, strRadio='RadioButton'; strCheck='CheckBox'; end
extra_funs(10,[0.05,0.75],[0.22,0.95]);
uicontrol('Style','Text','String','Grid',...
'Units','normalized','Position',[0.07,0.92,0.1,0.06],'BackgroundColor',0.8*[1,1,1]);
bbCtrl(1)=uicontrol('Style',strRadio,'String','On',...
'Units','normalized','Position',[0.09,0.85,0.1,0.07],...
'BackgroundColor',0.8*[1,1,1],'CallBack','extra_funs(4,1,''Value'',1,2);;');
bbCtrl(2)=uicontrol('Style',strRadio,'String','Off',...
'Units','normalized','Position',[0.09,0.77,0.1,0.07],...
'BackgroundColor',0.8*[1,1,1],'CallBack','extra_funs(4,1,''Value'',2,1);');
%% Define Box on/off
extra_funs(10,[0.26,0.75],[0.44,0.95]);
uicontrol('Style','Text','String','Box',...
'Units','normalized','Position',[0.28,0.92,0.1,0.06],'BackgroundColor',0.8*[1,1,1]);
bbCtrl(3)=uicontrol('Style',strRadio,'String','On',...
'Units','normalized','Position',[0.30,0.85,0.1,0.07],'BackgroundColor',0.8*[1,1,1],...
'CallBack','extra_funs(4,1,''Value'',3,4);');
bbCtrl(4)=uicontrol('Style',strRadio,'String','Off',...
'Units','normalized','Position',[0.30,0.77,0.1,0.07],'BackgroundColor',0.8*[1,1,1],...
'CallBack','extra_funs(4,1,''Value'',4,3);');
%% Apply All/Current Figure
extra_funs(10,[0.47,0.75],[0.77,0.95]);
uicontrol('Style','Text','String','Apply',...
'Units','normalized','Position',[0.49,0.92,0.12,0.06],'BackgroundColor',0.8*[1,1,1]);
bbCtrl(5)=uicontrol('Style',strRadio,'String','All Figures',...
'Units','normalized','Position',[0.51,0.85,0.22,0.07],'BackgroundColor',0.8*[1,1,1],...
'CallBack','extra_funs(4,1,''Value'',5,6);');
bbCtrl(6)=uicontrol('Style',strRadio,'String','Current Figure',...
'Units','normalized','Position',[0.51,0.77,0.25,0.07],'BackgroundColor',0.8*[1,1,1],...
'CallBack','extra_funs(4,1,''Value'',6,5);');
%% Plot Color Definition
extra_funs(10,[0.05,0.30],[0.73,0.69]);
uicontrol('Style','Text','String','Modify Color',...
'Units','normalized','Position',[0.32,0.64,0.20,0.08],...
'HorizontalAlignment','left','BackgroundColor',0.8*[1,1,1]);
bbCtrl(7)=uicontrol('Style','PushButton','String','Background Color Pallete',...
'Units','normalized','Position',[0.08,0.56,0.4,0.09],'CallBack','plot_proc(2);');
bbCtrl(8)=uicontrol('Style','PushButton','String','Default Color',...
'Units','normalized','Position',[0.51,0.56,0.2,0.09],'CallBack','set(gco,''UserData'',0.8*[1,1,1]);');
bbCtrl(9)=uicontrol('Style','PushButton','String','Plot Axis Color',...
'Units','normalized','Position',[0.08,0.45,0.4,0.09],'CallBack','plot_proc(3);');
bbCtrl(10)=uicontrol('Style','PushButton','String','Default Color',...
'Units','normalized','Position',[0.51,0.45,0.2,0.09],'CallBack','set(gco,''UserData'',[0,0,0]);');
bbCtrl(15)=uicontrol('Style','PushButton','String','Plot Color Pallete',...
'Units','normalized','Position',[0.08,0.34,0.4,0.09],'CallBack','plot_proc(4);');
bbCtrl(16)=uicontrol('Style','PushButton','String','Default Color',...
'Units','normalized','Position',[0.51,0.34,0.2,0.09],'CallBack','set(gco,''UserData'',[1,1,1]);');
if length(g_main)>0
% Define Model Combination
extra_funs(10,[0.05,0.024],[0.40,0.24]);
uicontrol('Style','Text','String',' Loops',...
'Units','normalized','Position',[0.07,0.18,0.11,0.08],...
'HorizontalAlignment','left','BackgroundColor',0.8*[1,1,1]);
bbCtrl(11)=uicontrol('Style',strRadio,'String','Open Loop',...
'Units','normalized','Position',[0.13,0.13,0.25,0.07],'Value',vv(1),...
'BackgroundColor',0.8*[1,1,1],'CallBack','plot_proc(7);');
bbCtrl(12)=uicontrol('Style',strRadio,'String','Closed Loop',...
'Units','normalized','Position',[0.13,0.05,0.25,0.07],'Value',vv(2),...
'BackgroundColor',0.8*[1,1,1],'CallBack','plot_proc(8);');
extra_funs(10,[0.45,0.024],[0.85,0.24]);
uicontrol('Style','Text','String',' Combinations',...
'Units','normalized','Position',[0.47,0.18,0.21,0.08],...
'BackgroundColor',0.8*[1,1,1],'HorizontalAlignment','left');
bbCtrl(13)=uicontrol('Style',strCheck,'String','Uncompensated',...
'Units','normalized','Position',[0.53,0.13,0.28,0.07],'Value',vv(3),...
'BackgroundColor',0.8*[1,1,1],'CallBack','plot_proc(9);');
bbCtrl(14)=uicontrol('Style',strCheck,'String','Compensated',...
'Units','normalized','Position',[0.53,0.05,0.25,0.07],'Value',vv(4),...
'BackgroundColor',0.8*[1,1,1],'CallBack','plot_proc(10);');
end
% Execute and Close Window
uicontrol('Style','PushButton','String','Change',...
'Units','normalized','Position',[0.80,0.88,0.18,0.09],'CallBack','plot_proc(5);');
uicontrol('Style','PushButton','String','Default',...
'Units','normalized','Position',[0.80,0.77,0.18,0.09],'CallBack','plot_proc(6); ');
uicontrol('Style','PushButton','String','Cancel',...
'Units','normalized','Position',[0.80,0.66,0.18,0.09],'CallBack','delete(gcf);');
uicontrol('Style','PushButton','String','Help',...
'Units','normalized','Position',[0.80,0.55,0.18,0.09],'CallBack','clab_help(19);');
set(g_win,'UserData',{bbCtrl,g_0});
else, figure(g_win); uu0=get(g_win,'UserData'); bbCtrl=uu0{1}; end
%set grid and box properties
bAxis=extra_funs(11,uu{1}(3),'Checked'); bBox=extra_funs(11,uu{1}(4),'Checked');
set(bbCtrl(1),'Value',bAxis); set(bbCtrl(2),'Value',~bAxis);
set(bbCtrl(3),'Value',bBox); set(bbCtrl(4),'Value',~bBox);
set(bbCtrl(5),'Value',0); set(bbCtrl(6),'Value',1);
%----------------------------------------------------------------------
%chg_plt_property is used to change the properties of selected objects.
%----------------------------------------------------------------------
function chg_plt_property()
uu=get(gcf,'UserData'); bbCtrl=uu{1}; g_wins=uu{2};
bGrid=extra_funs(6,get(bbCtrl(1),'Value')); bBox=extra_funs(6,get(bbCtrl(3),'Value'));
bAll=get(bbCtrl(5),'Value'); nCol1=get(bbCtrl(8),'UserData');
nCol2=get(bbCtrl(10),'UserData'); nCol3=get(bbCtrl(16),'UserData'); delete(gcf);
if bAll==1, g_wins=findobj('Tag','CtrlLABFigs');
elseif ~ishandle(g_wins),
errordlg('The figure window to be modified no longer exist','Error: Figure Modifying failed');
return;
end
for i=1:length(g_wins)
hh=g_wins(i); figure(hh); uu=get(gcf,'UserData'); ii=extra_funs(2);
set(ii,'Box',bBox,'XGrid',bGrid,'YGrid',bGrid);
if length(nCol1)==3, set(hh,'Color',nCol1); end
if length(nCol2)==3, set(ii,'XColor',nCol2,'YColor',nCol2); end
if length(nCol3)==3, set(ii,'Color',nCol3); end
set(uu{1}(3),'Checked',bGrid); set(uu{1}(4),'Checked',bBox);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -