PageRenderTime 28ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 1ms

/ATF2/FlightSim/testApps/IP_knob/IP_knob.m

http://atf2flightsim.googlecode.com/
MATLAB | 1499 lines | 624 code | 295 blank | 580 comment | 56 complexity | 4cb4cf9440b4a200055a6f0dd77adb1d MD5 | raw file
Possible License(s): BSD-2-Clause, LGPL-2.0, IPL-1.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. function varargout = IP_knob(varargin)
  2. % IP_KNOB M-file for IP_knob.fig
  3. % IP_KNOB, by itself, creates a new IP_KNOB or raises the existing
  4. % singleton*.
  5. %
  6. % H = IP_KNOB returns the handle to a new IP_KNOB or the handle to
  7. % the existing singleton*.
  8. %
  9. % IP_KNOB('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in IP_KNOB.M with the given input arguments.edit55
  11. %
  12. % IP_KNOB('Property','Value',...) creates a new IP_KNOB or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before IP_knob_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to IP_knob_OpeningFcn via varargin.
  17. %
  18. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  19. % instance to run (singleton)".
  20. %
  21. % See also: GUIDE, GUIDATA, GUIHANDLES
  22. % Edit the above text to modify the response to help IP_knob
  23. % Last Modified by GUIDE v2.5 15-Dec-2010 09:38:20
  24. % Begin initialization code - DO NOT EDIT
  25. gui_Singleton = 1;
  26. gui_State = struct('gui_Name', mfilename, ...
  27. 'gui_Singleton', gui_Singleton, ...
  28. 'gui_OpeningFcn', @IP_knob_OpeningFcn, ...
  29. 'gui_OutputFcn', @IP_knob_OutputFcn, ...
  30. 'gui_LayoutFcn', [] , ...
  31. 'gui_Callback', []);
  32. if nargin && ischar(varargin{1})
  33. gui_State.gui_Callback = str2func(varargin{1});
  34. end
  35. if nargout
  36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  37. else
  38. gui_mainfcn(gui_State, varargin{:});
  39. end
  40. % End initialization code - DO NOT EDIT
  41. % --- Executes just before IP_knob is made visible.
  42. function IP_knob_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject handle to figure
  45. % eventdata reserved - to be defined in a future version of MATLAB
  46. % handles structure with handles and user data (see GUIDATA)
  47. % varargin command line arguments to IP_knob (see VARARGIN)
  48. % Choose default command line output for IP_knob
  49. handles.output = hObject;
  50. % Update handles structure
  51. guidata(hObject, handles);
  52. % UIWAIT makes IP_knob wait for user response (see UIRESUME)
  53. % uiwait(handles.figure1);
  54. global BEAMLINE PS GIRDER FL IP_KNOBV;
  55. %% for i=1:length(length(FL.HwInfo.GIRDER))
  56. %% FlSetMoverLimits(i);
  57. %% end
  58. FlSetMoverLimits(50);FlSetMoverLimits(51);
  59. FlSetMoverLimits(52);FlSetMoverLimits(53);
  60. FlSetMoverLimits(54);
  61. FF_MAD_ini;
  62. load ./testApps/IP_knob/KNOB_VALUE;
  63. %% load ./testApps/IP_knob/KNOB_VALUE_FLT;
  64. tname = cellfun(@(x) x.Name, IP_KNOBV, 'UniformOutput',false);
  65. set(handles.popupmenu1, 'String', tname);
  66. %% QuadName = { 'QD6FF'; 'QF5BFF'; 'QF5AFF'};
  67. %% %% QuadName = { 'QD6FF'; 'QF5BFF'; 'QF5AFF'; 'QD4BFF'; 'QD4AFF'; 'QF3FF';...
  68. %% %% 'QD2BFF'; 'QD2AFF'; 'QF1FF'; 'QD0FF'};
  69. %% SextName = {'SF6FF'; 'SF5FF'; 'SD4FF'; 'SF1FF'; 'SD0FF'};
  70. handles.MagnetName = {'QD6FF'; 'QF5BFF'; 'QF5AFF'; 'QD4BFF'; 'QD4AFF'; 'QF3FF';...
  71. 'QD2BFF'; 'QD2AFF'; 'QF1FF'; 'QD0FF';...
  72. 'SF6FF'; 'SF5FF'; 'SD4FF'; 'SF1FF'; 'SD0FF'};
  73. handles.Mag_ps = zeros(1, length(handles.MagnetName));
  74. handles.Mag_Gir = zeros(1, length(handles.MagnetName));
  75. handles.ps_value_ini = zeros(1,length(handles.MagnetName));
  76. handles.mover_value_ini = zeros(length(handles.MagnetName),3);
  77. for i = 1:length(handles.MagnetName)
  78. ind = findcells(BEAMLINE,'Name',handles.MagnetName{i});
  79. handles.Mag_ps(i) = BEAMLINE{ind(1)}.PS;
  80. handles.Mag_Gir(i) = BEAMLINE{ind(1)}.Girder;
  81. handles.ps_value_ini(i) = PS(handles.Mag_ps(i)).SetPt ;
  82. handles.mover_value_ini(i,:)=GIRDER{handles.Mag_Gir(i)}.MoverSetPt;
  83. %% ps_value_ini(i) = PS(Mag_ps(i)).Ampl ;
  84. %% mover_ini(i,:)=GIRDER{Mag_Gir(i)}.MoverPos;
  85. end
  86. request={[] handles.Mag_ps []};
  87. [stat handles.respMag] = AccessRequest(request);
  88. if(stat{1}==-1)
  89. display(sprintf('AccessRequest returned error :%s',stat{2}));
  90. else
  91. display(sprintf('Access granted, ID of request : %s',handles.respMag));
  92. end
  93. request={handles.Mag_Gir [] []};
  94. [stat handles.resmMag] = AccessRequest(request);
  95. if(stat{1}==-1)
  96. display(sprintf('AccessRequest returned error :%s',stat{2}));
  97. else
  98. display(sprintf('Access granted, ID of request : %s',handles.resmMag));
  99. end
  100. %% handles.MagnetName = MagnetName;
  101. %% handles.Mag_ps = Mag_ps; %% all componets
  102. %% handles.Mag_Gir = Mag_Gir ;
  103. %% handles.ps_value_ini = ps_value_ini;
  104. %% handles.mover_value_ini = mover_value_ini;
  105. %% %% handles.ps_value = ps_value_ini;
  106. %% %% handles.mover_value = mover_value_ini;
  107. %% handles.respMag = respMag;
  108. %% handles.resmMag = resmMag;
  109. guidata(hObject,handles);
  110. IP_ind = findcells(BEAMLINE,'Name','IP'); %% 1717 not equal FL.SimModel.ip_ind =1735, %% 1703 not equal FL.SimModel.ip_ind = 1721
  111. handles.IP_ind = IP_ind;
  112. %% [stat,beamout] = TrackThru( 1, handles.IP_ind, FL.SimBeam{1}, 1, 1, 0 );
  113. [data txt beamout] = GetIPSimData(FL.SimBeam{1},FL.SimBeam{2},1, handles.IP_ind);
  114. [stat,Twissd]=GetTwiss(1,length(BEAMLINE), ...
  115. FL.SimModel.Initial.x.Twiss,FL.SimModel.Initial.y.Twiss);
  116. %% [ nx,xout] = hist(beamout.Bunch.x(1,:),100);
  117. %% [ ny,yout] = hist(beamout.Bunch.x(3,:),100);
  118. plot(handles.axes6, beamout.Bunch.x(1,:)*1e6, beamout.Bunch.x(3,:)*1e6,'b.');
  119. %% data.xwaist = Twissd.betax(handles.IP_ind)*Twissd.alphax(handles.IP_ind)/...
  120. %% (1+Twissd.alphax(handles.IP_ind)^2);
  121. %% data.xdisp = Twissd.etax(handles.IP_ind);
  122. %% data.ywaist = Twissd.betay(handles.IP_ind)*Twissd.alphay(handles.IP_ind)/...
  123. %% (1+Twissd.alphay(handles.IP_ind)^2);
  124. %% data.ydisp = Twissd.etay(handles.IP_ind);
  125. set(handles.edit4,'String',num2str(data.xwaist,'%5.2e'));
  126. set(handles.edit10,'String',num2str(data.xdisp,'%5.2e'));
  127. set(handles.edit5,'String',num2str(data.xsize,'%5.2e'));
  128. set(handles.edit6,'String',num2str(data.emit_x,'%5.2e'));
  129. set(handles.edit7,'String',num2str(data.ywaist,'%5.2e'));
  130. set(handles.edit11,'String',num2str(data.ydisp,'%5.2e'));
  131. set(handles.edit8,'String',num2str(data.ysize,'%5.2e'));
  132. set(handles.edit9,'String',num2str(data.emit_y,'%5.2e'));
  133. bar(handles.axes10, handles.ps_value_ini, 0.8)
  134. set(handles.axes10,'XTickLabel',handles.MagnetName)
  135. set(handles.axes10,'xlim',[0.5 length(handles.ps_value_ini)+0.5])
  136. %% axes(handles.axes11)
  137. bar(handles.axes11, handles.mover_value_ini(:,1), 0.8)
  138. set(handles.axes11,'XTickLabel',handles.MagnetName);
  139. set(handles.axes11,'xlim',[0.5 length(handles.mover_value_ini)+0.5])
  140. %% axes(handles.axes12)
  141. bar(handles.axes12, handles.mover_value_ini(:,2), 0.8)
  142. set(handles.axes12,'XTickLabel',handles.MagnetName)
  143. set(handles.axes12,'xlim',[0.5 length(handles.mover_value_ini)+0.5]);
  144. for ii = 12:44
  145. eval(['set(handles.edit',num2str(ii),',''String'',''0'')']);
  146. end
  147. handles.data(1)= data.xwaist;
  148. handles.data(2)= data.xdisp;
  149. handles.data(3)= data.xsize;
  150. handles.data(4)= data.emit_x;
  151. handles.data(5)= data.ywaist;
  152. handles.data(6)= data.ydisp;
  153. handles.data(7)= data.ysize;
  154. handles.data(8)= data.emit_y;
  155. for i=1:length(IP_KNOBV)
  156. handles.Knob_v(i) = 0;
  157. end
  158. handles.Knob_his(1,1) = 1;
  159. handles.Knob_his(1,2) = 0;
  160. %% val8 = get(handles.popupmenu8,'Value');
  161. %% handles.plot = get(handles.popupmenu8,'Value');
  162. guidata(hObject,handles);
  163. % --- Outputs from this function are returned to the command line.
  164. function varargout = IP_knob_OutputFcn(hObject, eventdata, handles)
  165. % varargout cell array for returning output args (see VARARGOUT);
  166. % hObject handle to figure
  167. % eventdata reserved - to be defined in a future version of MATLAB
  168. % handles structure with handles and user data (see GUIDATA)
  169. % Get default command line output from handles structure
  170. varargout{1} = handles.output;
  171. % --- Executes on selection change in popupmenu1.
  172. function popupmenu1_Callback(hObject, eventdata, handles)
  173. % hObject handle to popupmenu1 (see GCBO)
  174. % eventdata reserved - to be defined in a future version of MATLAB
  175. % handles structure with handles and user data (see GUIDATA)
  176. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
  177. % contents{get(hObject,'Value')} returns selected item from popupmenu1
  178. global BEAMLINE FL PS GIRDER IP_KNOBV;
  179. str = get(handles.popupmenu1, 'String');
  180. val = get(handles.popupmenu1, 'Value');
  181. mover_U = zeros(length(IP_KNOBV{val}.Ind(:,2)),3);
  182. mover_L = zeros(length(IP_KNOBV{val}.Ind(:,2)),3);
  183. %% set all mover up-low bound in FL.HwInfo.GIRDER.high low
  184. for i=1:length(FL.HwInfo.GIRDER)
  185. FL.HwInfo.GIRDER(i).high = FL.HwInfo.GIRDER(50).high ;
  186. FL.HwInfo.GIRDER(i).low = FL.HwInfo.GIRDER(50).low ;
  187. end
  188. mover_U = cat(1, FL.HwInfo.GIRDER(IP_KNOBV{val}.Ind(:,2)).high);
  189. mover_L = cat(1, FL.HwInfo.GIRDER(IP_KNOBV{val}.Ind(:,2)).low);
  190. dps_p = cat(1,FL.HwInfo.PS(IP_KNOBV{val}.Ind(:,1)).high) - cat(1,PS(IP_KNOBV{val}.Ind(:,1)).SetPt) ;
  191. dps_n = cat(1,PS(IP_KNOBV{val}.Ind(:,1)).SetPt)- cat(1,FL.HwInfo.PS(IP_KNOBV{val}.Ind(:,1)).low) ;
  192. set(handles.edit12,'String',num2str(IP_KNOBV{val}.Unit,'%5.2e'));
  193. us = dps_p./IP_KNOBV{val}.Ratio(:,1);
  194. ls = dps_n./IP_KNOBV{val}.Ratio(:,1);
  195. ux = mover_U(:,1)./IP_KNOBV{val}.Ratio(:,2);
  196. lx = mover_L(:,1)./IP_KNOBV{val}.Ratio(:,2);
  197. uy = mover_U(:,2)./IP_KNOBV{val}.Ratio(:,3);
  198. ly = mover_L(:,2)./IP_KNOBV{val}.Ratio(:,3);
  199. ur = mover_U(:,3)./IP_KNOBV{val}.Ratio(:,4);
  200. lr = mover_L(:,3)./IP_KNOBV{val}.Ratio(:,4);
  201. set(handles.edit56,'String', num2str(floor(min([min(us(us>0)), -max(ls(ls<0)),...
  202. min(ux(ux>0)), -max(lx(lx<0)),...
  203. min(uy(uy>0)), -max(ly(ly<0)),...
  204. min(ur(ur>0)), -max(lr(lr<0))]) ),'%d'));
  205. set(handles.edit58,'String', num2str(-floor(min([-max(us(us<0)),min(ls(ls>0)),...
  206. -max(ux(ux<0)),min(lx(lx>0)),...
  207. -max(uy(uy<0)),min(ly(ly>0)),...
  208. -max(ur(ur<0)),min(lr(lr>0))]) ),'%d'));
  209. % --- Executes during object creation, after setting all properties.
  210. function popupmenu1_CreateFcn(hObject, eventdata, handles)
  211. % hObject handle to popupmenu1 (see GCBO)
  212. % eventdata reserved - to be defined in a future version of MATLAB
  213. % handles empty - handles not created until after all CreateFcns called
  214. % Hint: popupmenu controls usually have a white background on Windows.
  215. % See ISPC and COMPUTER.
  216. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  217. set(hObject,'BackgroundColor','white');
  218. end
  219. % --- Executes on selection change in popupmenu4.
  220. function popupmenu4_Callback(hObject, eventdata, handles)
  221. % hObject handle to popupmenu4 (see GCBO)
  222. % eventdata reserved - to be defined in a future version of MATLAB
  223. % handles structure with handles and user data (see GUIDATA)
  224. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array
  225. % contents{get(hObject,'Value')} returns selected item from popupmenu4
  226. % --- Executes during object creation, after setting all properties.
  227. function popupmenu4_CreateFcn(hObject, eventdata, handles)
  228. % hObject handle to popupmenu4 (see GCBO)
  229. % eventdata reserved - to be defined in a future version of MATLAB
  230. % handles empty - handles not created until after all CreateFcns called
  231. % Hint: popupmenu controls usually have a white background on Windows.
  232. % See ISPC and COMPUTER.
  233. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  234. set(hObject,'BackgroundColor','white');
  235. end
  236. % --- Executes on selection change in popupmenu5.
  237. function popupmenu5_Callback(hObject, eventdata, handles)
  238. % hObject handle to popupmenu5 (see GCBO)
  239. % eventdata reserved - to be defined in a future version of MATLAB
  240. % handles structure with handles and user data (see GUIDATA)
  241. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array
  242. % contents{get(hObject,'Value')} returns selected item from popupmenu5
  243. % --- Executes during object creation, after setting all properties.
  244. function popupmenu5_CreateFcn(hObject, eventdata, handles)
  245. % hObject handle to popupmenu5 (see GCBO)
  246. % eventdata reserved - to be defined in a future version of MATLAB
  247. % handles empty - handles not created until after all CreateFcns called
  248. % Hint: popupmenu controls usually have a white background on Windows.
  249. % See ISPC and COMPUTER.
  250. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  251. set(hObject,'BackgroundColor','white');
  252. end
  253. % --- Executes on button press in pushbutton4.
  254. function pushbutton4_Callback(hObject, eventdata, handles)
  255. % hObject handle to pushbutton4 (see GCBO)
  256. % eventdata reserved - to be defined in a future version of MATLAB
  257. % handles structure with handles and user data (see GUIDATA)
  258. resp=questdlg('Are you sure?','Exit Request','Yes','No','No');
  259. if ~strcmp(resp,'Yes'); return; end;
  260. try
  261. guiCloseFn('IP_knob',handles);
  262. [stat resp] = AccessRequest('release',handles.respMag);
  263. [stat resp] = AccessRequest('release',handles.resmMag);
  264. catch
  265. %% exit
  266. end
  267. % --- Executes on button press in pushbutton6.
  268. function pushbutton6_Callback(hObject, eventdata, handles)
  269. % hObject handle to pushbutton6 (see GCBO)
  270. % eventdata reserved - to be defined in a future version of MATLAB
  271. % handles structure with handles and user data (see GUIDATA)
  272. global BEAMLINE IP_KNOBV GIRDER PS;
  273. str = get(handles.popupmenu1, 'String');
  274. val = get(handles.popupmenu1, 'Value');
  275. handles.hTableFigure = figure(... % The main GUI figure
  276. 'Name', IP_KNOBV{val}.Name, ...
  277. 'MenuBar','none', ...
  278. 'Toolbar','none', ...
  279. 'Position',[600 400 780 400],...
  280. 'NumberTitle', 'off',... % Do not show figure number
  281. 'HandleVisibility','callback', ...
  282. 'Color', get(0,...
  283. 'defaultuicontrolbackgroundcolor'));
  284. handles.hExitButton = uicontrol(... % Button for quitting selected knob
  285. 'Parent', handles.hTableFigure, ...
  286. 'Units','normalized',...
  287. 'HandleVisibility', 'callback',...
  288. 'Position',[0.025 0.9 0.15 0.07],...
  289. 'BackgroundColor', [0.961 0.922 0.922],...
  290. 'FontSize',14,...
  291. 'String','Exit',...
  292. 'Style','pushbutton',...
  293. 'BackgroundColor', 'r' );
  294. uicontrol(... % Knob type
  295. 'Parent', handles.hTableFigure, ...
  296. 'Units','normalized','callback',...
  297. 'HandleVisibility', ...
  298. 'Position',[0.185 0.9 0.18 0.07],...
  299. 'BackgroundColor', [0.855 0.702 1],...
  300. 'FontSize',14,...
  301. 'String','Knob Type', ...
  302. 'Style','Text');
  303. handles.hKTpopmenu = uicontrol(... % Knob type
  304. 'Parent', handles.hTableFigure, ...
  305. 'Units','normalized',...
  306. 'HandleVisibility', 'callback',...
  307. 'Position',[0.375 0.9 0.125 0.07],...
  308. 'BackgroundColor', [0.961 0.922 0.922],...
  309. 'FontSize',14,...
  310. 'String',{'Mover Knob' 'Strength Knob' 'Both'}, ...
  311. 'Style','popupmenu');
  312. uicontrol(... % Knob type
  313. 'Parent', handles.hTableFigure, ...
  314. 'Units','normalized',...
  315. 'HandleVisibility', 'callback',...
  316. 'Position',[0.525 0.9 0.125 0.07],...
  317. 'BackgroundColor', [0.855 0.702 1],...
  318. 'FontSize',14,...
  319. 'String','Step', ...
  320. 'Style','Text');
  321. handles.hStepedit = uicontrol(... % Knob type
  322. 'Parent', handles.hTableFigure, ...
  323. 'Units','normalized',...
  324. 'HandleVisibility', 'callback',...
  325. 'Position',[0.675 0.9 0.125 0.07],...
  326. 'BackgroundColor', [0.961 0.922 0.922],...
  327. 'FontSize',14,...
  328. 'String','10', ...
  329. 'Style','edit');
  330. handles.hSetButton = uicontrol(... % Button for quitting selected knob
  331. 'Parent', handles.hTableFigure, ...
  332. 'BackgroundColor', 'g', ...
  333. 'Units','normalized',...
  334. 'HandleVisibility', 'callback',...
  335. 'Position',[0.825 0.9 0.15 0.07],...
  336. 'BackgroundColor', [0.961 0.922 0.922],...
  337. 'FontSize',14,...
  338. 'String','Set',...
  339. 'Style','pushbutton');
  340. % set([handles.hExitButton,handles.hKTpopmenu,handles.hStepedit,handles.hSetButton],...
  341. %% {'callback'},{{@hExitButton_Callback,handles};{@hKTpopmenu_Callback,handles};...
  342. %% {@hStepedit_Callback,handles};{@hSetButton_Callback,handles}}) % Set callbacks.
  343. l_knob = length(IP_KNOBV{val}.Ind(:,1));
  344. for i = 1:l_knob
  345. handles.knobmname{i} = BEAMLINE{PS(IP_KNOBV{val}.Ind(i,1)).Element(1)}.Name;
  346. handles.kbps_value(i) = PS(IP_KNOBV{val}.Ind(i,1)).SetPt ;
  347. handles.kbmover_value(i,:) = GIRDER{IP_KNOBV{val}.Ind(i,2)}.MoverSetPt;
  348. end
  349. if (length(handles.knobmname) > l_knob)
  350. handles.knobmname(l_knob+1:end)=[];
  351. handles.kbps_value(l_knob+1:end) = [] ;
  352. handles.kbmover_value((l_knob+1:end),:)= [];
  353. end
  354. %% tname = cellfun(@(x) x.Name, BEAMLINE, 'UniformOutput',false);
  355. [c, handles.ia, ib] = intersect(handles.MagnetName, handles.knobmname);
  356. %% handles.kbps_value_ini = handles.ps_value_ini(handles.ia);
  357. %% handles.kbmover_value_ini = handles.mover_value_ini(ia);
  358. % Create a figure that will have a uitable or axes or checkboxes
  359. %% pknob = uipanel('Parent',hTableFigure,'Title',str{val},'FontSize',12,...
  360. %% 'BackgroundColor','white','Position',[100, 100, 600, 800]);
  361. %% tknob = uitable('Parent',pknob,'Data',IP_KNOBV{val}.Ratio,'ColumnName',{'strength','x-mover','y-mover','rotation'},...
  362. %% 'RowName',knobmname,'Position',[0.1 .78 .8 .2]);
  363. % Define parameters for a uitable (col headers are fictional)
  364. colnames = {'Strenth', 'xmover', 'ymover', 'rotation'};
  365. % All column contain numeric data (integers, actually)
  366. colfmt = {'numeric', 'numeric', 'numeric', 'numeric'};
  367. % Disallow editing values (but this can be changed)
  368. coledit = [false false false false];
  369. % Set columns all the same width (must be in pixels)
  370. colwdt = {120 120 120 120};
  371. % Create a uitable on the left side of the figure
  372. handles.htable = uitable('Parent',handles.hTableFigure, 'Units', 'normalized',...
  373. 'Position', [0.025 0.5 0.975 0.38],...
  374. 'BackgroundColor', [0.961 0.922 0.922],...
  375. 'Data', IP_KNOBV{val}.Ratio,...
  376. 'ColumnName', colnames,...
  377. 'ColumnFormat', colfmt,...
  378. 'ColumnWidth', colwdt,...
  379. 'ColumnEditable', coledit,...
  380. 'RowName', handles.knobmname);
  381. rcolnames = {'Strenth','read', 'xmover','read','ymover','read', 'rotation','read'};
  382. % All column contain numeric data (integers, actually)
  383. rcolfmt = {'numeric', 'numeric', 'numeric', 'numeric'};
  384. % Disallow editing values (but this can be changed)
  385. rcoledit = [false false false false false false false false ];
  386. %% [true true true true true true true true ];
  387. % Set columns all the same width (must be in pixels)
  388. rcolwdt = {80 80 80 80 80 80 80 80 };
  389. %% data = {'set', 'read','set', 'read','set', 'read','set', 'read'; ...
  390. %% [IP_KNOBV{val}.Ratio, IP_KNOBV{val}.Ratio]};
  391. ttdata = {[IP_KNOBV{val}.Ratio, IP_KNOBV{val}.Ratio]};
  392. uitable('Parent',handles.hTableFigure, 'Units', 'normalized',...
  393. 'Position', [0.025 0.435 0.975 0.065],...
  394. 'BackgroundColor', [0.961 0.922 0.922],...
  395. 'ColumnName', [{''}, colnames],...
  396. 'ColumnWidth', {80 160 160 160 160 },...
  397. 'ColumnEditable', coledit,...
  398. 'RowName',[]);
  399. kbdata = [IP_KNOBV{val}.Ratio(:,1),IP_KNOBV{val}.Ratio(:,1),...
  400. IP_KNOBV{val}.Ratio(:,2),IP_KNOBV{val}.Ratio(:,2),...
  401. IP_KNOBV{val}.Ratio(:,3),IP_KNOBV{val}.Ratio(:,3),...
  402. IP_KNOBV{val}.Ratio(:,4),IP_KNOBV{val}.Ratio(:,4)];
  403. handles.htableread = uitable('Parent',handles.hTableFigure, 'Units', 'normalized',...
  404. 'Position', [0.025 0.025 0.975 0.41],...
  405. 'ColumnName',{'set','read', 'set','read','set','read', 'set','read'},...
  406. 'Data', kbdata,...
  407. 'ColumnWidth', rcolwdt,...
  408. 'RowName', handles.knobmname);
  409. %% set([handles.hExitButton, handles.hStepedit, handles.hSetButton],...
  410. %% {'callback'},{{@hExitButton_Callback,handles};{@hStepedit_Callback,handles};...
  411. %% {@hSetButton_Callback,handles}}) % Set callbacks.
  412. set([handles.hExitButton, handles.hSetButton],...
  413. {'callback'},{{@hExitButton_Callback,handles};{@hSetButton_Callback,handles}}) % Set callbacks.
  414. set([handles.htable, handles.htableread],...
  415. {'CellSelectionCallback'},{{@htable_Callback,handles};{@htableread_Callback,handles}}) % Set callbacks.
  416. guidata(hObject,handles);
  417. function hExitButton_Callback(varargin)
  418. handles=varargin{3};
  419. delete(handles.hTableFigure);
  420. %% function hStepedit_Callback(varargin)
  421. %% handles=varargin{3};
  422. %% guidata(hObject,handles);
  423. function hSetButton_Callback(hObject, eventdata, handles)
  424. global BEAMLINE FL IP_KNOBV GIRDER PS;
  425. %% handles=varargin{3};
  426. str = get(handles.popupmenu1, 'String');
  427. val = get(handles.popupmenu1, 'Value');
  428. str7 = get(handles.hKTpopmenu, 'String');
  429. val7 = get(handles.hKTpopmenu, 'Value');
  430. knob_value = eval(['[',get(handles.hStepedit,'String'),']']);
  431. switch lower(str7{val7})
  432. case {'strength knob'}
  433. [handles.kbps_value] = set_ps(IP_KNOBV{val}.Ind(:,1)',IP_KNOBV{val}.Ratio(:,1)'*knob_value+ handles.kbps_value );
  434. bar(handles.axes10, handles.kbps_value -handles.ps_value_ini(handles.ia), 0.8);
  435. set(handles.axes10,'XTickLabel',handles.knobmname);
  436. set(handles.axes10,'xlim',[0.5 length(handles.knobmname)+0.5]);
  437. case {'mover knob'}
  438. [old_value, handles.kbmover_value] = set_mover(IP_KNOBV{val}.Ind(:,2)', IP_KNOBV{val}.Ratio(:,2:4)*knob_value+handles.kbmover_value);
  439. bar(handles.axes11, handles.kbmover_value(:,1) - handles.mover_value_ini(handles.ia,1), 0.8);
  440. set(handles.axes11,'XTickLabel',handles.knobmname);
  441. set(handles.axes11,'xlim',[0.5 length(handles.knobmname)+0.5]);
  442. bar(handles.axes12, handles.kbmover_value(:,2) - handles.mover_value_ini(handles.ia,2), 0.8);
  443. set(handles.axes12,'XTickLabel',handles.knobmname);
  444. set(handles.axes12,'xlim',[0.5 length(handles.knobmname)+0.5]);
  445. otherwise
  446. [handles.kbps_value] = set_ps(IP_KNOBV{val}.Ind(:,1)',IP_KNOBV{val}.Ratio(:,1)'*knob_value+ handles.kbps_value );
  447. bar(handles.axes10, handles.kbps_value -handles.ps_value_ini(handles.ia), 0.8);
  448. set(handles.axes10,'XTickLabel',handles.knobmname);
  449. set(handles.axes10,'xlim',[0.5 length(handles.knobmname)+0.5]);
  450. [old_value, handles.kbmover_value] = set_mover(IP_KNOBV{val}.Ind(:,2)', IP_KNOBV{val}.Ratio(:,2:4)*knob_value+handles.kbmover_value);
  451. bar(handles.axes11, handles.kbmover_value(:,1) - handles.mover_value_ini(handles.ia,1), 0.8);
  452. set(handles.axes11,'XTickLabel',handles.knobmname);
  453. set(handles.axes11,'xlim',[0.5 length(handles.knobmname)+0.5]);
  454. bar(handles.axes12, handles.kbmover_value(:,2) - handles.mover_value_ini(handles.ia,2), 0.8);
  455. set(handles.axes12,'XTickLabel',handles.knobmname);
  456. set(handles.axes12,'xlim',[0.5 length(handles.knobmname)+0.5]);
  457. end
  458. kbdata(:,1) = handles.kbps_value';
  459. kbdata(:,[3 5 7]) = handles.kbmover_value;
  460. for i = 1:length(IP_KNOBV{val}.Ind(:,1))
  461. kbdata(i,2) = PS(IP_KNOBV{val}.Ind(i,1)).Ampl ;
  462. kbdata(i,[4 6 8]) = GIRDER{IP_KNOBV{val}.Ind(i,2)}.MoverPos;
  463. end
  464. set(handles.htableread, 'data', kbdata);
  465. %% [stat,beamout] = TrackThru( 1, handles.IP_ind, FL.SimBeam{1}, 1, 1, 0 );
  466. [data txt beamout] = GetIPSimData(FL.SimBeam{1},FL.SimBeam{2},1, handles.IP_ind);
  467. [stat,Twissd]=GetTwiss(1,length(BEAMLINE), ...
  468. FL.SimModel.Initial.x.Twiss,FL.SimModel.Initial.y.Twiss);
  469. % data.ydisp = Twissd.etay(handles.IP_ind);
  470. set(handles.edit4,'String',num2str(data.xwaist,'%5.2e'));
  471. set(handles.edit10,'String',num2str(data.xdisp,'%5.2e'));
  472. set(handles.edit5,'String',num2str(data.xsize,'%5.2e'));
  473. set(handles.edit6,'String',num2str(data.emit_x,'%5.2e'));
  474. set(handles.edit7,'String',num2str(data.ywaist,'%5.2e'));
  475. set(handles.edit11,'String',num2str(data.ydisp,'%5.2e'));
  476. set(handles.edit8,'String',num2str(data.ysize,'%5.2e'));
  477. set(handles.edit9,'String',num2str(data.emit_y,'%5.2e'));
  478. %% [stat,beamout,instdata] = TrackThru( 1, IP_ind, FL.SimBeam{1}, 1, 1, 0 );
  479. [ nx,xout] = hist(beamout.Bunch.x(1,:),100);
  480. [ ny,yout] = hist(beamout.Bunch.x(3,:),100);
  481. %% axes(handles.axes9)
  482. %% cla;
  483. plot(handles.axes6, beamout.Bunch.x(1,:)*1e6, beamout.Bunch.x(3,:)*1e6, 'r.');
  484. handles.data(end+1)= data.xwaist;
  485. handles.data(end+1)= data.xdisp;
  486. handles.data(end+1)= data.xsize;
  487. handles.data(end+1)= data.emit_x;
  488. handles.data(end+1)= data.ywaist;
  489. handles.data(end+1)= data.ydisp;
  490. handles.data(end+1)= data.ysize;
  491. handles.data(end+1)= data.emit_y;
  492. handles.Knob_v(val) = handles.Knob_v(val) + knob_value ;
  493. handles.Knob_his(end+1,1) = val;
  494. handles.Knob_his(end+1,2) = knob_value;
  495. if (val < 17)
  496. tt1 = num2str(handles.Knob_v(val));
  497. eval(['set(handles.edit',num2str(11+2*val),',''String'',',tt1, ');']);
  498. tt2 = num2str(handles.Knob_v(val)*IP_KNOBV{val}.Unit,'%5.2e');
  499. eval(['set(handles.edit',num2str(12+2*val),',''String'',',tt2, ');']);
  500. end
  501. val8 = get(handles.popupmenu8,'Value');
  502. plot(handles.axes9, handles.data(val8:8:end), 'r');
  503. %% plot(handles.axes9, handles.data(handles.plot:8:end), 'r');
  504. %% plot(handles.axes9, beamout.Bunch.x(1,:), beamout.Bunch.x(3,:), 'b.');
  505. %% guidata(varargin{1},handles);
  506. set(handles.hSetButton,{'callback'},{{@hSetButton_Callback,handles}}) %% important to self pass the parameters
  507. %% Set callbacks.
  508. %% %%% guidata(hObject,handles); %% wrong the parameters doesn't pass out
  509. guidata(handles.output, handles); %% important to save
  510. % --- Executes on button press in pushbutton7.
  511. function pushbutton7_Callback(hObject, eventdata, handles)
  512. % hObject handle to pushbutton7 (see GCBO)
  513. % eventdata reserved - to be defined in a future version of MATLAB
  514. % handles structure with handles and user data (see GUIDATA)
  515. function edit1_Callback(hObject, eventdata, handles)
  516. % hObject handle to edit1 (see GCBO)
  517. % eventdata reserved - to be defined in a future version of MATLAB
  518. % handles structure with handles and user data (see GUIDATA)
  519. % Hints: get(hObject,'String') returns contents of edit1 as text
  520. % str2double(get(hObject,'String')) returns contents of edit1 as a double
  521. % --- Executes during object creation, after setting all properties.
  522. function edit1_CreateFcn(hObject, eventdata, handles)
  523. % hObject handle to edit1 (see GCBO)
  524. % eventdata reserved - to be defined in a future version of MATLAB
  525. % handles empty - handles not created until after all CreateFcns called
  526. % Hint: edit controls usually have a white background on Windows.
  527. % See ISPC and COMPUTER.
  528. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  529. set(hObject,'BackgroundColor','white');
  530. end
  531. % --- Executes on button press in pushbutton8.
  532. function pushbutton8_Callback(hObject, eventdata, handles)
  533. % hObject handle to pushbutton8 (see GCBO)
  534. % eventdata reserved - to be defined in a future version of MATLAB
  535. % handles structure with handles and user data (see GUIDATA)
  536. global BEAMLINE FL IP_KNOBV;
  537. %% str7 = get(handles.popupmenu7, 'String');
  538. %% val7 = get(handles.popupmenu7,'Value');
  539. %% switch val7
  540. %% case 1
  541. [ps_value] = set_ps(handles.Mag_ps,handles.ps_value_ini);
  542. bar(handles.axes10, ps_value - handles.ps_value_ini, 0.8);
  543. set(handles.axes10,'XTickLabel',handles.MagnetName);
  544. set(handles.axes10,'xlim',[0.5 length(ps_value)+0.5]);
  545. [old_value, mover_value] = set_mover(handles.Mag_Gir, handles.mover_value_ini);
  546. %% axes(handles.axes12)
  547. bar(handles.axes11, mover_value(:,1) - handles.mover_value_ini(:,1), 0.8);
  548. set(handles.axes11,'XTickLabel',handles.MagnetName);
  549. set(handles.axes11,'xlim',[0.5 length(mover_value)+0.5]);
  550. bar(handles.axes12, mover_value(:,2) - handles.mover_value_ini(:,2), 0.8);
  551. set(handles.axes12,'XTickLabel',handles.MagnetName);
  552. set(handles.axes12,'xlim',[0.5 length(mover_value)+0.5]);
  553. for ii = 12:44
  554. eval(['set(handles.edit',num2str(ii),',''String'',''0'')']);
  555. end
  556. %% end
  557. [data txt beamout] = GetIPSimData(FL.SimBeam{1},FL.SimBeam{2},1, handles.IP_ind);
  558. [stat,Twissd]=GetTwiss(1,length(BEAMLINE), ...
  559. FL.SimModel.Initial.x.Twiss,FL.SimModel.Initial.y.Twiss);
  560. set(handles.edit4,'String',num2str(data.xwaist,'%5.2e'));
  561. set(handles.edit10,'String',num2str(data.xdisp,'%5.2e'));
  562. set(handles.edit5,'String',num2str(data.xsize,'%5.2e'));
  563. set(handles.edit6,'String',num2str(data.emit_x,'%5.2e'));
  564. set(handles.edit7,'String',num2str(data.ywaist,'%5.2e'));
  565. set(handles.edit11,'String',num2str(data.ydisp,'%5.2e'));
  566. set(handles.edit8,'String',num2str(data.ysize,'%5.2e'));
  567. set(handles.edit9,'String',num2str(data.emit_y,'%5.2e'));
  568. [ nx,xout] = hist(beamout.Bunch.x(1,:),100);
  569. [ ny,yout] = hist(beamout.Bunch.x(3,:),100);
  570. %% axes(handles.axes9)
  571. %% cla
  572. plot(handles.axes6, beamout.Bunch.x(1,:)*1e6, beamout.Bunch.x(3,:)*1e6, 'r.');
  573. handles.data(end+1)= data.xwaist;
  574. handles.data(end+1)= data.xdisp;
  575. handles.data(end+1)= data.xsize;
  576. handles.data(end+1)= data.emit_x;
  577. handles.data(end+1)= data.ywaist;
  578. handles.data(end+1)= data.ydisp;
  579. handles.data(end+1)= data.ysize;
  580. handles.data(end+1)= data.emit_y;
  581. %% handles.plot = get(handles.popupmenu8,'Value');
  582. %% plot(handles.axes9, handles.data(handles.plot:8:end));
  583. for ii=1:length(handles.Knob_v)
  584. handles.Knob_v(ii) = 0;
  585. end
  586. handles.Knob_his(end+1,1) = 0.0;
  587. handles.Knob_his(end+1,2) = 0.0;
  588. guidata(hObject,handles);
  589. function edit2_Callback(hObject, eventdata, handles)
  590. % hObject handle to edit2 (see GCBO)
  591. % eventdata reserved - to be defined in a future version of MATLAB
  592. % handles structure with handles and user data (see GUIDATA)
  593. % Hints: get(hObject,'String') returns contents of edit2 as text
  594. % str2double(get(hObject,'String')) returns contents of edit2 as a double
  595. % --- Executes during object creation, after setting all properties.
  596. function edit2_CreateFcn(hObject, eventdata, handles)
  597. % hObject handle to edit2 (see GCBO)
  598. % eventdata reserved - to be defined in a future version of MATLAB
  599. % handles empty - handles not created until after all CreateFcns called
  600. % Hint: edit controls usually have a white background on Windows.
  601. % See ISPC and COMPUTER.
  602. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  603. set(hObject,'BackgroundColor','white');
  604. end
  605. function edit3_Callback(hObject, eventdata, handles)
  606. % hObject handle to edit3 (see GCBO)
  607. % eventdata reserved - to be defined in a future version of MATLAB
  608. % handles structure with handles and user data (see GUIDATA)
  609. % Hints: get(hObject,'String') returns contents of edit3 as text
  610. % str2double(get(hObject,'String')) returns contents of edit3 as a double
  611. % --- Executes during object creation, after setting all properties.
  612. function edit3_CreateFcn(hObject, eventdata, handles)
  613. % hObject handle to edit3 (see GCBO)
  614. % eventdata reserved - to be defined in a future version of MATLAB
  615. % handles empty - handles not created until after all CreateFcns called
  616. % Hint: edit controls usually have a white background on Windows.
  617. % See ISPC and COMPUTER.
  618. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  619. set(hObject,'BackgroundColor','white');
  620. end
  621. % --- Executes on selection change in popupmenu7.
  622. function popupmenu7_Callback(hObject, eventdata, handles)
  623. % hObject handle to popupmenu7 (see GCBO)
  624. % eventdata reserved - to be defined in a future version of MATLAB
  625. % handles structure with handles and user data (see GUIDATA)
  626. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu7 contents as cell array
  627. % contents{get(hObject,'Value')} returns selected item from popupmenu7
  628. % --- Executes during object creation, after setting all properties.
  629. function popupmenu7_CreateFcn(hObject, eventdata, handles)
  630. % hObject handle to popupmenu7 (see GCBO)
  631. % eventdata reserved - to be defined in a future version of MATLAB
  632. % handles empty - handles not created until after all CreateFcns called
  633. % Hint: popupmenu controls usually have a white background on Windows.
  634. % See ISPC and COMPUTER.
  635. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  636. set(hObject,'BackgroundColor','white');
  637. end
  638. % --- Executes on button press in 3.
  639. function pushbutton9_Callback(hObject, eventdata, handles)
  640. % hObject handle to pushbutton9 (see GCBO)
  641. % eventdata reserved - to be defined in a future version of MATLAB
  642. % handles structure with handles and user data (see GUIDATA)
  643. %% range = eval(['[',get(handles.edit2,'String'),']']);
  644. %% step = eval(['[',get(handles.edit1,'String'),']']);
  645. global BEAMLINE IP_KNOBV;
  646. str = get(handles.popupmenu1, 'String');
  647. val = get(handles.popupmenu1, 'Value');
  648. nn = length(str)+1;
  649. %% uitable('Units', 'normalized',...
  650. %% 'Position', [0.025 0.5 0.975 0.05],...
  651. %% 'BackgroundColor', [0.961 0.922 0.922],...
  652. %% 'RowName',handles.MagnetName);
  653. [sel,ok] = listdlg('PromptString','Select the magnets:',...
  654. 'SelectionMode','multi',...
  655. 'ListString',handles.MagnetName);
  656. prompt = {'Enter knob name:','Enter knob magnet name:','Enter knob strenth ratio:',...
  657. 'Enter knob x mover ratio:','Enter knob y mover ratio:','Enter knob rotation ratio'};
  658. dlg_title = 'Add new knob';
  659. num_lines = 1;
  660. def = {'User1_IP_Wx','{ ''SF6FF''; ''SF5FF''; ''SD4FF''; ''SF1FF''; ''SD0FF'' }','1; 0.1 ; 0.05; 1; -0.2',...
  661. '0; 0; 0; 0; 0 ','0; 0; 0; 0; 0 ','0; 0; 0; 0; 0 ', '0; 0; 0; 0; 0 '};
  662. if(ok)
  663. def{2} = '{''' ;
  664. for ii = 1: length(sel)-1
  665. def{2} = [def{2}, handles.MagnetName{sel(ii)}, '''; '''];
  666. end
  667. def{2} = [def{2}, handles.MagnetName{sel(end)}, '''}'];
  668. end
  669. options.Resize='on';
  670. answer = inputdlg(prompt,dlg_title,num_lines,def,options);
  671. tname = cellfun(@(x) x.Name, IP_KNOBV, 'UniformOutput',false);
  672. if (find(strmatch(answer{1}, char(tname))))
  673. choice = questdlg('The knob name is used. Do you want to replace the original one?');
  674. %% switch choice
  675. %% case 'Yes'
  676. %% aa = strmatch(answer{1}, char(tname));
  677. else
  678. str{nn} = answer{1};
  679. MagnetName = eval(answer{2});
  680. set(handles.popupmenu1, 'String', str);
  681. handles.Knob_v(nn) = 0;
  682. IP_KNOBV{nn}.Name=answer{1};
  683. IP_KNOBV{nn}.Unit=[];
  684. ipstre = str2num(answer{3});
  685. xmover = str2num(answer{4});
  686. ymover = str2num(answer{5});
  687. rotation = str2num(answer{6});
  688. IP_KNOBV{nn}.Ratio = zeros(length(MagnetName),4);
  689. for i = 1:length(MagnetName)
  690. ind = findcells(BEAMLINE,'Name',MagnetName{i});
  691. IP_KNOBV{nn}.Ind(i,1) = BEAMLINE{ind(1)}.PS;
  692. IP_KNOBV{nn}.Ind(i,2) = BEAMLINE{ind(1)}.Girder;
  693. IP_KNOBV{nn}.Ratio(i,1)= ipstre(i);
  694. IP_KNOBV{nn}.Ratio(i,2)= xmover(i);
  695. IP_KNOBV{nn}.Ratio(i,3)= ymover(i);
  696. IP_KNOBV{nn}.Ratio(i,4)= rotation(i);
  697. end
  698. end
  699. %% %% load .\testApps\IP_knob\KNOB_VALUE;
  700. % Proceed with callback...
  701. function edit4_Callback(hObject, eventdata, handles)
  702. % hObject handle to edit4 (see GCBO)
  703. % eventdata reserved - to be defined in a future version of MATLAB
  704. % handles structure with handles and user data (see GUIDATA)
  705. % Hints: get(hObject,'String') returns contents of edit4 as text
  706. % str2double(get(hObject,'String')) returns contents of edit4 as a double
  707. % --- Executes during object creation, after setting all properties.
  708. function edit4_CreateFcn(hObject, eventdata, handles)
  709. % hObject handle to edit4 (see GCBO)
  710. % eventdata reserved - to be defined in a future version of MATLAB
  711. % handles empty - handles not created until after all CreateFcns called
  712. % Hint: edit controls usually have a white background on Windows.
  713. % See ISPC and COMPUTER.
  714. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  715. set(hObject,'BackgroundColor','white');
  716. end
  717. function edit5_Callback(hObject, eventdata, handles)
  718. % hObject handle to edit5 (see GCBO)
  719. % eventdata reserved - to be defined in a future version of MATLAB
  720. % handles structure with handles and user data (see GUIDATA)
  721. % Hints: get(hObject,'String') returns contents of edit5 as text
  722. % str2double(get(hObject,'String')) returns contents of edit5 as a double
  723. % --- Executes during object creation, after setting all properties.
  724. function edit5_CreateFcn(hObject, eventdata, handles)
  725. % hObject handle to edit5 (see GCBO)
  726. % eventdata reserved - to be defined in a future version of MATLAB
  727. % handles empty - handles not created until after all CreateFcns called
  728. % Hint: edit controls usually have a white background on Windows.
  729. % See ISPC and COMPUTER.
  730. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  731. set(hObject,'BackgroundColor','white');
  732. end
  733. function edit6_Callback(hObject, eventdata, handles)
  734. % hObject handle to edit6 (see GCBO)
  735. % eventdata reserved - to be defined in a future version of MATLAB
  736. % handles structure with handles and user data (see GUIDATA)
  737. % Hints: get(hObject,'String') returns contents of edit6 as text
  738. % str2double(get(hObject,'String')) returns contents of edit6 as a double
  739. % --- Executes during object creation, after setting all properties.
  740. function edit6_CreateFcn(hObject, eventdata, handles)
  741. % hObject handle to edit6 (see GCBO)
  742. % eventdata reserved - to be defined in a future version of MATLAB
  743. % handles empty - handles not created until after all CreateFcns called
  744. % Hint: edit controls usually have a white background on Windows.
  745. % See ISPC and COMPUTER.
  746. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  747. set(hObject,'BackgroundColor','white');
  748. end
  749. function edit7_Callback(hObject, eventdata, handles)
  750. % hObject handle to edit7 (see GCBO)
  751. % eventdata reserved - to be defined in a future version of MATLAB
  752. % handles structure with handles and user data (see GUIDATA)
  753. % Hints: get(hObject,'String') returns contents of edit7 as text
  754. % str2double(get(hObject,'String')) returns contents of edit7 as a double
  755. % --- Executes during object creation, after setting all properties.
  756. function edit7_CreateFcn(hObject, eventdata, handles)
  757. % hObject handle to edit7 (see GCBO)
  758. % eventdata reserved - to be defined in a future version of MATLAB
  759. % handles empty - handles not created until after all CreateFcns called
  760. % Hint: edit controls usually have a white background on Windows.
  761. % See ISPC and COMPUTER.
  762. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  763. set(hObject,'BackgroundColor','white');
  764. end
  765. function edit8_Callback(hObject, eventdata, handles)
  766. % hObject handle to edit8 (see GCBO)
  767. % eventdata reserved - to be defined in a future version of MATLAB
  768. % handles structure with handles and user data (see GUIDATA)
  769. % Hints: get(hObject,'String') returns contents of edit8 as text
  770. % str2double(get(hObject,'String')) returns contents of edit8 as a double
  771. % --- Executes during object creation, after setting all properties.
  772. function edit8_CreateFcn(hObject, eventdata, handles)
  773. % hObject handle to edit8 (see GCBO)
  774. % eventdata reserved - to be defined in a future version of MATLAB
  775. % handles empty - handles not created until after all CreateFcns called
  776. % Hint: edit controls usually have a white background on Windows.
  777. % See ISPC and COMPUTER.
  778. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  779. set(hObject,'BackgroundColor','white');
  780. end
  781. function edit9_Callback(hObject, eventdata, handles)
  782. % hObject handle to edit9 (see GCBO)
  783. % eventdata reserved - to be defined in a future version of MATLAB
  784. % handles structure with handles and user data (see GUIDATA)
  785. % Hints: get(hObject,'String') returns contents of edit9 as text
  786. % str2double(get(hObject,'String')) returns contents of edit9 as a double
  787. % --- Executes during object creation, after setting all properties.
  788. function edit9_CreateFcn(hObject, eventdata, handles)
  789. % hObject handle to edit9 (see GCBO)
  790. % eventdata reserved - to be defined in a future version of MATLAB
  791. % handles empty - handles not created until after all CreateFcns called
  792. % Hint: edit controls usually have a white background on Windows.
  793. % See ISPC and COMPUTER.
  794. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  795. set(hObject,'BackgroundColor','white');
  796. end
  797. function edit10_Callback(hObject, eventdata, handles)
  798. % hObject handle to edit10 (see GCBO)
  799. % eventdata reserved - to be defined in a future version of MATLAB
  800. % handles structure with handles and user data (see GUIDATA)
  801. % Hints: get(hObject,'String') returns contents of edit10 as text
  802. % str2double(get(hObject,'String')) returns contents of edit10 as a double
  803. % --- Executes during object creation, after setting all properties.
  804. function edit10_CreateFcn(hObject, eventdata, handles)
  805. % hObject handle to edit10 (see GCBO)
  806. % eventdata reserved - to be defined in a future version of MATLAB
  807. % handles empty - handles not created until after all CreateFcns called
  808. % Hint: edit controls usually have a white background on Windows.
  809. % See ISPC and COMPUTER.
  810. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  811. set(hObject,'BackgroundColor','white');
  812. end
  813. function edit11_Callback(hObject, eventdata, handles)
  814. % hObject handle to edit11 (see GCBO)
  815. % eventdata reserved - to be defined in a future version of MATLAB
  816. % handles structure with handles and user data (see GUIDATA)
  817. % Hints: get(hObject,'String') returns contents of edit11 as text
  818. % str2double(get(hObject,'String')) returns contents of edit11 as a double
  819. % --- Executes during object creation, after setting all properties.
  820. function edit11_CreateFcn(hObject, eventdata, handles)
  821. % hObject handle to edit11 (see GCBO)
  822. % eventdata reserved - to be defined in a future version of MATLAB
  823. % handles empty - handles not created until after all CreateFcns called
  824. % Hint: edit controls usually have a white background on Windows.
  825. % See ISPC and COMPUTER.
  826. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  827. set(hObject,'BackgroundColor','white');
  828. end
  829. function edit12_Callback(hObject, eventdata, handles)
  830. % hObject handle to edit12 (see GCBO)
  831. % eventdata reserved - to be defined in a future version of MATLAB
  832. % handles structure with handles and user data (see GUIDATA)
  833. % Hints: get(hObject,'String') returns contents of edit12 as text
  834. % str2double(get(hObject,'String')) returns contents of edit12 as a double
  835. % --- Executes during object creation, after setting all properties.
  836. function edit12_CreateFcn(hObject, eventdata, handles)
  837. % hObject handle to edit12 (see GCBO)
  838. % eventdata reserved - to be defined in a future version of MATLAB
  839. % handles empty - handles not created until after all CreateFcns called
  840. % Hint: edit controls usually have a white background on Windows.
  841. % See ISPC and COMPUTER.
  842. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  843. set(hObject,'BackgroundColor','white');
  844. end
  845. function edit13_Callback(hObject, eventdata, handles)
  846. % hObject handle to edit13 (see GCBO)
  847. % eventdata reserved - to be defined in a future version of MATLAB
  848. % handles structure with handles and user data (see GUIDATA)
  849. % Hints: get(hObject,'String') returns contents of edit13 as text
  850. % str2double(get(hObject,'String')) returns contents of edit13 as a double
  851. % --- Executes during object creation, after setting all properties.
  852. function edit13_CreateFcn(hObject, eventdata, handles)
  853. % hObject handle to edit13 (see GCBO)
  854. % eventdata reserved - to be defined in a future version of MATLAB
  855. % handles empty - handles not created until after all CreateFcns called
  856. % Hint: edit controls usually have a white background on Windows.
  857. % See ISPC and COMPUTER.
  858. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  859. set(hObject,'BackgroundColor','white');
  860. end
  861. function edit14_Callback(hObject, eventdata, handles)
  862. % hObject handle to edit14 (see GCBO)
  863. % eventdata reserved - to be defined in a future version of MATLAB
  864. % handles structure with handles and user data (see GUIDATA)
  865. % Hints: get(hObject,'String') returns contents of edit14 as text
  866. % str2double(get(hObject,'String')) returns contents of edit14 as a double
  867. % --- Executes during object creation, after setting all properties.
  868. function edit14_CreateFcn(hObject, eventdata, handles)
  869. % hObject handle to edit14 (see GCBO)
  870. % eventdata reserved - to be defined in a future version of MATLAB
  871. % handles empty - handles not created until after all CreateFcns called
  872. % Hint: edit controls usually have a white background on Windows.
  873. % See ISPC and COMPUTER.
  874. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  875. set(hObject,'BackgroundColor','white');
  876. end
  877. function edit15_Callback(hObject, eventdata, handles)
  878. % hObject handle to edit15 (see GCBO)
  879. % eventdata reserved - to be defined in a future version of MATLAB
  880. % handles structure with handles and user data (see GUIDATA)
  881. % Hints: get(hObject,'String') returns contents of edit15 as text
  882. % str2double(get(hObject,'String')) returns contents of edit15 as a double
  883. % --- Executes during object creation, after setting all properties.
  884. function edit15_CreateFcn(hObject, eventdata, handles)
  885. % hObject handle to edit15 (see GCBO)
  886. % eventdata reserved - to be defined in a future version of MATLAB
  887. % handles empty - handles not created until after all CreateFcns called
  888. % Hint: edit controls usually have a white background on Windows.
  889. % See ISPC and COMPUTER.
  890. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  891. set(hObject,'BackgroundColor','white');
  892. end
  893. function edit16_Callback(hObject, eventdata, handles)
  894. % hObject handle to edit16 (see GCBO)
  895. % eventdata reserved - to be defined in a future version of MATLAB
  896. % handles structure with handles and user data (see GUIDATA)
  897. % Hints: get(hObject,'String') returns contents of edit16 as text
  898. % str2double(get(hObject,'String')) returns contents of edit16 as a double
  899. % --- Executes during object creation, after setting all properties.
  900. function edit16_CreateFcn(hObject, eventdata, handles)
  901. % hObject handle to edit16 (see GCBO)
  902. % eventdata reserved - to be defined in a future version of MATLAB
  903. % handles empty - handles not created until after all CreateFcns called
  904. % Hint: edit controls usually have a white background on Windows.
  905. % See ISPC and COMPUTER.
  906. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  907. set(hObject,'BackgroundColor','white');
  908. end
  909. function edit17_Callback(hObject, eventdata, handles)
  910. % hObject handle to edit17 (see GCBO)
  911. % eventdata reserved - to be defined in a future version of MATLAB
  912. % handles structure with handles and user data (see GUIDATA)
  913. % Hints: get(hObject,'String') returns contents of edit17 as text
  914. % str2double(get(hObject,'String')) returns contents of edit17 as a double
  915. % --- Executes during object creation, after setting all properties.
  916. function edit17_CreateFcn(hObject, eventdata, handles)
  917. % hObject handle to edit17 (see GCBO)
  918. % eventdata reserved - to be defined in a future version of MATLAB
  919. % handles empty - handles not created until after all CreateFcns called
  920. % Hint: edit controls usually have a white background on Windows.
  921. % See ISPC and COMPUTER.
  922. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  923. set(hObject,'BackgroundColor','white');
  924. end
  925. function edit18_Callback(hObject, eventdata, handles)
  926. % hObject handle to edit18 (see GCBO)
  927. % eventdata reserved - to be defined in a future version of MATLAB
  928. % handles structure with handles and user data (see GUIDATA)
  929. % Hints: get(hObject,'String') returns contents of edit18 as text
  930. % str2double(get(hObject,'String')) returns contents of edit18 as a double
  931. % --- Executes during object creation, after setting all properties.
  932. function edit18_CreateFcn(hObject, eventdata, handles)
  933. % hObject handle to edit18 (see GCBO)
  934. % eventdata reserved - to be defined in a future version of MATLAB
  935. % handles empty - handles not created until after all CreateFcns called
  936. % Hint: edit controls usually hav

Large files files are truncated, but you can click here to view the full file