0001 function fig = atslider(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 global THERING
0033
0034 if nargin >1
0035
0036
0037
0038 KnobData = varargin{1};
0039 KnobName = varargin{2};
0040
0041
0042 NumVar = length(KnobData);
0043 I = [KnobData.Position];
0044 F = [KnobData.FieldName];
0045 M = [KnobData.M];
0046 N = [KnobData.N];
0047 W = [KnobData.Weight];
0048 for i = 1:NumVar
0049 OriginalValues(i) = getfield(THERING{I(i)},F(i),{M(i),N(i)});
0050 end
0051
0052
0053 h0 = figure('Color', [0.8 0.8 0.8], ...
0054 'FileName','D:\MATLABR11\work\atslider.m', ...
0055 'HandleVisibility', 'Callback' , ...
0056 'PaperPosition',[18 180 576 432], ...
0057 'PaperUnits','points', ...
0058 'Position',[520 400 300 140], ...
0059 'Tag','Fig1', ...
0060 'ToolBar','none');
0061 if nargout > 0
0062 fig = h0;
0063 end
0064
0065 s1 = uicontrol('Parent',h0, ...
0066 'Units','points', ...
0067 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
0068 'ListboxTop',0, ...
0069 'Position',[20 20 100 15], ...
0070 'Style','slider', ...
0071 'Max',1, 'Min', -1, ...
0072 'Callback','atslider set', ...
0073 'Tag','Slider1');
0074
0075 e1 = uicontrol('Parent',h0, ...
0076 'Units','points', ...
0077 'BackgroundColor',[1 1 1], ...
0078 'ListboxTop',0, ...
0079 'Position',[140 20 65 15], ...
0080 'Style','edit', ...
0081 'Callback','atslider set', ...
0082 'Tag','EditText1');
0083
0084
0085 if nargin == 2
0086 set(h0,'UserData',{e1 s1 KnobData OriginalValues});
0087 elseif nargin == 3
0088 set(h0,'UserData',{e1 s1 KnobData OriginalValues varargin{3}});
0089 end
0090
0091
0092 t1 = uicontrol('Parent',h0, ...
0093 'Units','points', ...
0094 'BackgroundColor',[0.8 0.8 0.8], ...
0095 'FontSize',12, ...
0096 'ListboxTop',0, ...
0097 'Position',[20 60 165 20], ...
0098 'String',KnobName, ...
0099 'Style','text', ...
0100 'Tag',KnobName);
0101
0102 elseif nargin == 1
0103 action = varargin{1};
0104
0105
0106 UD = get(gcbf,'UserData');
0107 eh = UD{1};
0108 sh = UD{2};
0109 OV = UD{4};
0110 if(length(UD)==5)
0111 COMMAND = UD{5};
0112
0113 COMMAND = strcat('figure(3);',COMMAND);
0114 else
0115 COMMAND = '';
0116 end
0117
0118
0119 I = [UD{3}.Position];
0120 F = [UD{3}.FieldName];
0121 M = [UD{3}.M];
0122 N = [UD{3}.N];
0123 W = [UD{3}.Weight];
0124
0125 switch lower(action)
0126 case 'set'
0127 whoiscalling = gcbo;
0128
0129 switch(whoiscalling)
0130 case sh
0131 newvalue = get(sh,'Value');
0132 set(eh,'String',newvalue)
0133 case eh
0134 newvalue = sscanf(get(eh,'String'),'%f');
0135 set(sh,'Value',newvalue);
0136 end
0137
0138
0139
0140 for i = 1:length(OV)
0141 THERING{I(i)}=setfield(THERING{I(i)},F(i),{M(i),N(i)},OV(i)+newvalue*W(i));
0142 end
0143 evalin('base',COMMAND);
0144 case 'reset'
0145
0146 end
0147
0148 end
0149
0150
0151
0152