1 | function varargout = mosteffectivecorrectorgui(varargin) |
---|
2 | % MOSTEFFECTIVECORRECTORGUI M-file for mosteffectivecorrectorgui.fig |
---|
3 | % MOSTEFFECTIVECORRECTORGUI, by itself, creates a new MOSTEFFECTIVECORRECTORGUI or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = MOSTEFFECTIVECORRECTORGUI returns the handle to a new MOSTEFFECTIVECORRECTORGUI or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % MOSTEFFECTIVECORRECTORGUI('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in MOSTEFFECTIVECORRECTORGUI.M with the given input arguments. |
---|
11 | % |
---|
12 | % MOSTEFFECTIVECORRECTORGUI('Property','Value',...) creates a new MOSTEFFECTIVECORRECTORGUI or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before mosteffectivecorrectorgui_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to mosteffectivecorrectorgui_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 | |
---|
23 | % Edit the above text to modify the response to help mosteffectivecorrectorgui |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 24-Jan-2008 13:03:58 |
---|
26 | |
---|
27 | % Begin initialization code - DO NOT EDIT |
---|
28 | gui_Singleton = 1; |
---|
29 | gui_State = struct('gui_Name', mfilename, ... |
---|
30 | 'gui_Singleton', gui_Singleton, ... |
---|
31 | 'gui_OpeningFcn', @mosteffectivecorrectorgui_OpeningFcn, ... |
---|
32 | 'gui_OutputFcn', @mosteffectivecorrectorgui_OutputFcn, ... |
---|
33 | 'gui_LayoutFcn', [] , ... |
---|
34 | 'gui_Callback', []); |
---|
35 | if nargin && ischar(varargin{1}) |
---|
36 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
37 | end |
---|
38 | |
---|
39 | if nargout |
---|
40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
41 | else |
---|
42 | gui_mainfcn(gui_State, varargin{:}); |
---|
43 | end |
---|
44 | % End initialization code - DO NOT EDIT |
---|
45 | |
---|
46 | |
---|
47 | % --- Executes just before mosteffectivecorrectorgui is made visible. |
---|
48 | function mosteffectivecorrectorgui_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
49 | % This function has no output args, see OutputFcn. |
---|
50 | % hObject handle to figure |
---|
51 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
52 | % handles structure with handles and user data (see GUIDATA) |
---|
53 | % varargin command line arguments to mosteffectivecorrectorgui (see VARARGIN) |
---|
54 | |
---|
55 | % Choose default command line output for mosteffectivecorrectorgui |
---|
56 | handles.output = hObject; |
---|
57 | |
---|
58 | % |
---|
59 | handles.Rmat = getbpmresp('Struct'); |
---|
60 | nBPMx = length(family2dev('BPMx')); |
---|
61 | nHCOR = length(family2dev('HCOR')); |
---|
62 | nBPMy = length(family2dev('BPMz')); |
---|
63 | nVCOR = length(family2dev('VCOR')); |
---|
64 | |
---|
65 | handles.Hdelcm{1} = zeros(nHCOR,1); |
---|
66 | handles.Vdelcm{1} = zeros(nVCOR,1); |
---|
67 | handles.ResidualHOrbit{1} = zeros(nBPMx,nHCOR); |
---|
68 | handles.ResidualVOrbit{1} = zeros(nBPMy,nVCOR); |
---|
69 | handles.HRefOrbit = zeros(nBPMx,nHCOR); |
---|
70 | handles.VRefOrbit = zeros(nBPMy,nVCOR); |
---|
71 | handles.HOrbit = getx; |
---|
72 | handles.VOrbit = getz; |
---|
73 | handles.correctornumber = 1; |
---|
74 | handles.HGoalOrbit = getgolden('BPMx'); |
---|
75 | handles.VGoalOrbit = getgolden('BPMz'); |
---|
76 | handles.spos = getspos('BPMx'); |
---|
77 | handles.Hiter = 1; % Iteration num in H-plane |
---|
78 | handles.Viter = 1; % Iteration num in H-plane |
---|
79 | handles.HCORselect = 1; |
---|
80 | handles.HCORRemove = []; |
---|
81 | handles.VCORselect = 1; |
---|
82 | handles.VCORRemove = []; |
---|
83 | |
---|
84 | % Update handles structure |
---|
85 | guidata(hObject, handles); |
---|
86 | |
---|
87 | % UIWAIT makes mosteffectivecorrectorgui wait for user response (see UIRESUME) |
---|
88 | % uiwait(handles.figure1); |
---|
89 | |
---|
90 | |
---|
91 | % --- Outputs from this function are returned to the command line. |
---|
92 | function varargout = mosteffectivecorrectorgui_OutputFcn(hObject, eventdata, handles) |
---|
93 | % varargout cell array for returning output args (see VARARGOUT); |
---|
94 | % hObject handle to figure |
---|
95 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
96 | % handles structure with handles and user data (see GUIDATA) |
---|
97 | |
---|
98 | % Get default command line output from handles structure |
---|
99 | varargout{1} = handles.output; |
---|
100 | |
---|
101 | |
---|
102 | % --- Executes on selection change in listbox_Hcorrector. |
---|
103 | function listbox_Hcorrector_Callback(hObject, eventdata, handles) |
---|
104 | % hObject handle to listbox_Hcorrector (see GCBO) |
---|
105 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
106 | % handles structure with handles and user data (see GUIDATA) |
---|
107 | |
---|
108 | % Hints: contents = get(hObject,'String') returns listbox_Hcorrector contents as cell array |
---|
109 | % contents{get(hObject,'Value')} returns selected item from listbox_Hcorrector |
---|
110 | |
---|
111 | plotHdata(hObject, handles); |
---|
112 | |
---|
113 | % --- Executes during object creation, after setting all properties. |
---|
114 | function listbox_Hcorrector_CreateFcn(hObject, eventdata, handles) |
---|
115 | % hObject handle to listbox_Hcorrector (see GCBO) |
---|
116 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
117 | % handles empty - handles not created until after all CreateFcns called |
---|
118 | |
---|
119 | % Hint: listbox controls usually have a white background on Windows. |
---|
120 | % See ISPC and COMPUTER. |
---|
121 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
122 | set(hObject,'BackgroundColor','white'); |
---|
123 | end |
---|
124 | |
---|
125 | |
---|
126 | % --- Executes on button press in pushbutton_Hfind. |
---|
127 | function pushbutton_Hfind_Callback(hObject, eventdata, handles) |
---|
128 | % hObject handle to pushbutton_Hfind (see GCBO) |
---|
129 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
130 | % handles structure with handles and user data (see GUIDATA) |
---|
131 | |
---|
132 | iFam = 'BPMx'; |
---|
133 | %set(handles.listbox_Hcorrector,'Value',1); |
---|
134 | |
---|
135 | iterNum = handles.Hiter |
---|
136 | |
---|
137 | if iterNum == 1 |
---|
138 | %handles.HGoalOrbit = getgolden(iFam); |
---|
139 | handles.HGoalOrbit = handles.HRefOrbit; |
---|
140 | handles.HCORRemove = []; |
---|
141 | set(handles.text_HGoldenRMS, 'String', num2str(std(handles.HGoalOrbit), '%3.2e')); |
---|
142 | else |
---|
143 | handles.HGoalOrbit = handles.ResidualHOrbit{iterNum-1}(:, handles.HCORselect(iterNum-1)); |
---|
144 | end |
---|
145 | |
---|
146 | %handles.HGoalOrbitNew = handles.HGoalOrbit; |
---|
147 | |
---|
148 | % refreshthering; |
---|
149 | %handles.HOrbit = getx; |
---|
150 | |
---|
151 | OrbitDiff = handles.HOrbit - handles.HGoalOrbit; |
---|
152 | |
---|
153 | % Loop over all valid correctors |
---|
154 | for k = 1:size(handles.Rmat(1,1).Data,2), |
---|
155 | Rmat = handles.Rmat(1,1).Data(:,k); |
---|
156 | handles.Hdelcm{iterNum}(k,:) = -pinv(Rmat)*OrbitDiff; %-Rmat\OrbitDiff; |
---|
157 | handles.ResidualHOrbit{iterNum}(:,k) = handles.Rmat(1,1).Data(:,k)*handles.Hdelcm{iterNum}(k,:) ... |
---|
158 | + OrbitDiff; |
---|
159 | end |
---|
160 | |
---|
161 | % Look for most effective corrector |
---|
162 | Xrms = std(handles.ResidualHOrbit{iterNum}); |
---|
163 | [tmp ind] = sort(Xrms,'Ascend'); |
---|
164 | |
---|
165 | % Remove correctors already used in previous iterations |
---|
166 | [tmp1 tmp2] = intersect(handles.Rmat(1,1).Actuator.DeviceList(ind,:), handles.HCORRemove,'rows'); |
---|
167 | if ~isempty(tmp1), |
---|
168 | ind(tmp2) = []; |
---|
169 | end |
---|
170 | |
---|
171 | fprintf('H-corrector [%2d %2d] is set to % 6.2e A or % 6.2e µT.m\n', handles.Rmat(1,1).Actuator.DeviceList(ind(1),:), ... |
---|
172 | handles.Hdelcm{iterNum}(ind(1)), hw2physics('HCOR', 'Setpoint', handles.Hdelcm{iterNum}(ind(1)), [1 1])*getbrho); |
---|
173 | |
---|
174 | set(handles.text_HRMS, 'String', num2str(std(handles.ResidualHOrbit{iterNum}(:,1)), '%3.2e')); |
---|
175 | |
---|
176 | handles.HCORRemove(iterNum,:) = handles.Rmat(1,1).Actuator.DeviceList(ind(1),:); |
---|
177 | handles.HCORselect(iterNum) = ind(1); |
---|
178 | |
---|
179 | % Update handles structure |
---|
180 | guidata(hObject, handles); |
---|
181 | |
---|
182 | plotHdata(hObject, handles); |
---|
183 | |
---|
184 | % --- Executes as a subfunction |
---|
185 | function plotHdata(hObject, handles) |
---|
186 | |
---|
187 | iterNum = handles.Hiter; |
---|
188 | |
---|
189 | % look whether most effective corrector function already was run for this iteration |
---|
190 | lastIter = size(handles.HCORRemove, 1); |
---|
191 | if isempty(handles.HCORRemove) || lastIter < iterNum |
---|
192 | if iterNum - lastIter > 1 |
---|
193 | set(handles.popupmenu_Hiter,'Value', lastIter +1); |
---|
194 | handles.Hiter = lastIter +1; |
---|
195 | end |
---|
196 | pushbutton_Hfind_Callback(handles.pushbutton_Hfind , [], handles) |
---|
197 | end |
---|
198 | |
---|
199 | iterNum = handles.Hiter |
---|
200 | |
---|
201 | Bind = get(handles.listbox_Hcorrector,'Value'); |
---|
202 | Hrms = std(handles.ResidualHOrbit{iterNum}); |
---|
203 | [tmp ind] = sort(Hrms,'Ascend'); |
---|
204 | |
---|
205 | handles.HCORselect(handles.Hiter) = ind(Bind(1)); |
---|
206 | %handles.HCORRemove(iterNum,:) = handles.Rmat(1,1).Actuator.DeviceList(ind(1),:); |
---|
207 | %handles.HCORRemove(iterNum,:) = handles.Rmat(1,1).Actuator.DeviceList(ind(Bind(1)),:); |
---|
208 | |
---|
209 | set(handles.text_HRMS, 'String', num2str(std(handles.ResidualHOrbit{iterNum}(:,ind(Bind(1)))), '%3.2e')); |
---|
210 | |
---|
211 | spos = handles.spos; |
---|
212 | |
---|
213 | axes(handles.axes_Horbit) |
---|
214 | cla |
---|
215 | %plot(spos, handles.HGoalOrbit ,'k-*'); hold on |
---|
216 | %plot(spos, handles.ResidualHOrbit{handles.Hiter}(:,ind(Bind(1))) + handles.HGoalOrbit, 'r') |
---|
217 | plot(spos, handles.HOrbit - handles.HGoalOrbit ,'k-*'); hold on |
---|
218 | plot(spos, handles.ResidualHOrbit{handles.Hiter}(:,ind(Bind(1))) + (handles.HOrbit - handles.HGoalOrbit), 'r') |
---|
219 | |
---|
220 | grid on; |
---|
221 | xlabel('s-position (m)'); |
---|
222 | ylabel('H-orbit (mm)'); |
---|
223 | |
---|
224 | % Corrector strenghts |
---|
225 | axes(handles.axes_Hcorrector) |
---|
226 | cla |
---|
227 | plot(handles.Hdelcm{handles.Hiter}); |
---|
228 | hold on; plot(ind(Bind(1)), handles.Hdelcm{handles.Hiter}(ind(Bind(1))), 'k*'); |
---|
229 | grid on; |
---|
230 | xlabel('H-corrector number'); |
---|
231 | ylabel('Current (A)'); |
---|
232 | |
---|
233 | %handles.Hdelcm(ind(1)); |
---|
234 | |
---|
235 | % Residual orbit for selected corrector |
---|
236 | axes(handles.axes_Hrmsorbit) |
---|
237 | cla |
---|
238 | plot(Hrms); |
---|
239 | grid on; |
---|
240 | hold on; plot(ind(Bind(1)), Hrms(ind(Bind(1))), 'k*') |
---|
241 | xlabel('H-corrector number'); |
---|
242 | ylabel('Delta Orbit rms (mm)'); |
---|
243 | |
---|
244 | ListBoxString = []; |
---|
245 | % Remove correctors already used in previous iterations |
---|
246 | % [tmp1 tmp2] = intersect(handles.Rmat(1,1).Actuator.DeviceList(ind,:), handles.HCORRemove,'rows'); |
---|
247 | % if ~isempty(tmp1), |
---|
248 | % ind(tmp2) = []; |
---|
249 | % end |
---|
250 | |
---|
251 | for k=1:size(ind,2), |
---|
252 | ListBoxString = strvcat(ListBoxString, sprintf('[%2d %2d] = %+6.2e \n', ... |
---|
253 | handles.Rmat(1,1).Actuator.DeviceList(ind(k),:), handles.Hdelcm{handles.Hiter}(ind(k)))); |
---|
254 | end |
---|
255 | |
---|
256 | set(handles.listbox_Hcorrector, 'String', ListBoxString); |
---|
257 | |
---|
258 | % Update handles structure |
---|
259 | guidata(hObject, handles); |
---|
260 | |
---|
261 | % --- Executes as a subfunction |
---|
262 | function plotVdata(handles) |
---|
263 | |
---|
264 | iterNum = handles.Viter; |
---|
265 | |
---|
266 | % look whether most effective corrector function already was run for this iteration |
---|
267 | lastIter = size(handles.VCORRemove, 1); |
---|
268 | if isempty(handles.VCORRemove) || lastIter < iterNum |
---|
269 | if iterNum - lastIter > 1 |
---|
270 | set(handles.popupmenu_Viter,'Value', lastIter +1); |
---|
271 | handles.Viter = lastIter +1; |
---|
272 | end |
---|
273 | pushbutton_Vfind_Callback(handles.pushbutton_Vfind , [], handles) |
---|
274 | end |
---|
275 | |
---|
276 | iterNum = handles.Viter |
---|
277 | |
---|
278 | Bind = get(handles.listbox_Vcorrector,'Value'); |
---|
279 | Vrms = std(handles.ResidualVOrbit{iterNum}); |
---|
280 | [tmp ind] = sort(Vrms,'Ascend'); |
---|
281 | |
---|
282 | handles.VCORselect(handles.Viter) = ind(Bind(1)); |
---|
283 | % handles.VCORRemove(iterNum,:) = handles.Rmat(2,2).Actuator.DeviceList(ind(1),:); |
---|
284 | |
---|
285 | set(handles.text_VRMS, 'String', num2str(std(handles.ResidualVOrbit{iterNum}(:,ind(Bind(1)))), '%3.2e')); |
---|
286 | spos = handles.spos; |
---|
287 | |
---|
288 | axes(handles.axes_Vorbit) |
---|
289 | cla |
---|
290 | plot(spos, handles.VGoalOrbit ,'k-*'); hold on |
---|
291 | |
---|
292 | plot(spos, handles.ResidualVOrbit{handles.Viter}(:,ind(Bind(1))) + handles.VGoalOrbit, 'r') |
---|
293 | |
---|
294 | grid on; |
---|
295 | xlabel('s-position (m)'); |
---|
296 | ylabel('V-orbit (mm)'); |
---|
297 | |
---|
298 | % Corrector strenghts |
---|
299 | axes(handles.axes_Vcorrector) |
---|
300 | cla |
---|
301 | plot(handles.Vdelcm{handles.Viter}); |
---|
302 | hold on; plot(ind(Bind(1)), handles.Vdelcm{handles.Viter}(ind(Bind(1))), 'k*'); |
---|
303 | grid on; |
---|
304 | xlabel('V-corrector number'); |
---|
305 | ylabel('Current (A)'); |
---|
306 | |
---|
307 | % Residual orbit for selected corrector |
---|
308 | axes(handles.axes_Vrmsorbit) |
---|
309 | cla |
---|
310 | plot(Vrms); |
---|
311 | grid on; |
---|
312 | hold on; plot(ind(Bind(1)), Vrms(ind(Bind(1))), 'k*') |
---|
313 | xlabel('V-corrector number'); |
---|
314 | ylabel('Delta Orbit rms (mm)'); |
---|
315 | |
---|
316 | ListBoxString = []; |
---|
317 | % Remove correctors already used in previous iterations |
---|
318 | % [tmp1 tmp2] = intersect(handles.Rmat(2,2).Actuator.DeviceList(ind,:), handles.VCORRemove,'rows'); |
---|
319 | % if ~isempty(tmp1), |
---|
320 | % ind(tmp2) = []; |
---|
321 | % end |
---|
322 | |
---|
323 | for k=1:size(ind,2), |
---|
324 | ListBoxString = strvcat(ListBoxString, sprintf('[%2d %2d] = %+6.2e \n', ... |
---|
325 | handles.Rmat(2,2).Actuator.DeviceList(ind(k),:), handles.Vdelcm{handles.Viter}(ind(k)))); |
---|
326 | end |
---|
327 | |
---|
328 | set(handles.listbox_Vcorrector, 'String', ListBoxString); |
---|
329 | |
---|
330 | |
---|
331 | |
---|
332 | % --- Executes on selection change in listbox_Vcorrector. |
---|
333 | function listbox_Vcorrector_Callback(hObject, eventdata, handles) |
---|
334 | % hObject handle to listbox_Vcorrector (see GCBO) |
---|
335 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
336 | % handles structure with handles and user data (see GUIDATA) |
---|
337 | |
---|
338 | % Hints: contents = get(hObject,'String') returns listbox_Vcorrector contents as cell array |
---|
339 | % contents{get(hObject,'Value')} returns selected item from listbox_Vcorrector |
---|
340 | plotVdata(handles); |
---|
341 | |
---|
342 | % --- Executes during object creation, after setting all properties. |
---|
343 | function listbox_Vcorrector_CreateFcn(hObject, eventdata, handles) |
---|
344 | % hObject handle to listbox_Vcorrector (see GCBO) |
---|
345 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
346 | % handles empty - handles not created until after all CreateFcns called |
---|
347 | |
---|
348 | % Hint: listbox controls usually have a white background on Windows. |
---|
349 | % See ISPC and COMPUTER. |
---|
350 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
351 | set(hObject,'BackgroundColor','white'); |
---|
352 | end |
---|
353 | |
---|
354 | |
---|
355 | % --- Executes on button press in pushbutton_Vfind. |
---|
356 | function pushbutton_Vfind_Callback(hObject, eventdata, handles) |
---|
357 | % hObject handle to pushbutton_Vfind (see GCBO) |
---|
358 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
359 | % handles structure with handles and user data (see GUIDATA) |
---|
360 | |
---|
361 | iFam = 'BPMz'; |
---|
362 | %set(handles.listbox_Hcorrector,'Value',1); |
---|
363 | |
---|
364 | iterNum = handles.Viter |
---|
365 | |
---|
366 | if iterNum == 1 |
---|
367 | handles.VGoalOrbit = getgolden(iFam); |
---|
368 | handles.VCORRemove = []; |
---|
369 | set(handles.text_VGoldenRMS, 'String', num2str(std(handles.VGoalOrbit), '%3.2e')); |
---|
370 | else |
---|
371 | handles.VGoalOrbit = handles.ResidualVOrbit{iterNum-1}(:, handles.VCORselect(iterNum-1)); |
---|
372 | end |
---|
373 | |
---|
374 | handles.VOrbit = getz; |
---|
375 | |
---|
376 | OrbitDiff = handles.VOrbit - handles.VGoalOrbit; |
---|
377 | |
---|
378 | % Loop over all valid correctors |
---|
379 | for k = 1:size(handles.Rmat(2,2).Data,2), |
---|
380 | Rmat = handles.Rmat(2,2).Data(:,k); |
---|
381 | handles.Vdelcm{iterNum}(k,:) = -Rmat \ OrbitDiff; |
---|
382 | handles.ResidualVOrbit{iterNum}(:,k) = handles.Rmat(2,2).Data(:,k)*handles.Vdelcm{iterNum}(k) ... |
---|
383 | + OrbitDiff; |
---|
384 | end |
---|
385 | |
---|
386 | % Look for most effective corrector |
---|
387 | Vrms = std(handles.ResidualVOrbit{iterNum}); |
---|
388 | [tmp ind] = sort(Vrms,'Ascend'); |
---|
389 | |
---|
390 | % Remove correctors already used in previous iterations |
---|
391 | [tmp1 tmp2] = intersect(handles.Rmat(1,1).Actuator.DeviceList(ind,:), handles.VCORRemove,'rows'); |
---|
392 | if ~isempty(tmp1), |
---|
393 | ind(tmp2) = []; |
---|
394 | end |
---|
395 | |
---|
396 | fprintf('V-corrector [%2d %2d] is set to % 6.2e A or % 6.2e µT.m\n\n', handles.Rmat(2,2).Actuator.DeviceList(ind(1),:), ... |
---|
397 | handles.Vdelcm{iterNum}(ind(1)), hw2physics('VCOR', 'Setpoint', handles.Vdelcm{iterNum}(ind(1)),[1 1])*getbrho); |
---|
398 | |
---|
399 | set(handles.text_VRMS, 'String', num2str(std(handles.ResidualVOrbit{iterNum}(:,1)), '%3.2e')); |
---|
400 | |
---|
401 | handles.VCORRemove(iterNum,:) = handles.Rmat(2,2).Actuator.DeviceList(ind(1),:); |
---|
402 | handles.VCORselect(iterNum) = ind(1); |
---|
403 | |
---|
404 | % Update handles structure |
---|
405 | guidata(hObject, handles); |
---|
406 | |
---|
407 | plotVdata(handles); |
---|
408 | |
---|
409 | |
---|
410 | % -------------------------------------------------------------------- |
---|
411 | function uimenu_loadHreffile_Callback(hObject, eventdata, handles) |
---|
412 | % hObject handle to uimenu_loadHreffile (see GCBO) |
---|
413 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
414 | % handles structure with handles and user data (see GUIDATA) |
---|
415 | |
---|
416 | [fileName directoryName] = uigetfile('*.mat','Select H-BPM file as H-reference'); |
---|
417 | |
---|
418 | set(handles.text_Hreffilename,'String', fileName); |
---|
419 | |
---|
420 | tmp = load(fileName); |
---|
421 | |
---|
422 | handles.HRefOrbit = tmp.Data1.Data; |
---|
423 | |
---|
424 | |
---|
425 | % Update handles structure |
---|
426 | guidata(hObject, handles); |
---|
427 | |
---|
428 | % -------------------------------------------------------------------- |
---|
429 | function uimenu_loadHfile_Callback(hObject, eventdata, handles) |
---|
430 | % hObject handle to uimenu_loadHfile (see GCBO) |
---|
431 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
432 | % handles structure with handles and user data (see GUIDATA) |
---|
433 | [fileName directoryName] = uigetfile('*.mat','Select H-BPM file as H-reference'); |
---|
434 | |
---|
435 | %set(handles.text_Hreffilename,'String', fileName); |
---|
436 | |
---|
437 | tmp = load(fileName); |
---|
438 | |
---|
439 | handles.HOrbit = tmp.Data1.Data; |
---|
440 | |
---|
441 | % Update handles structure |
---|
442 | guidata(hObject, handles); |
---|
443 | |
---|
444 | |
---|
445 | % --- Executes on selection change in popupmenu_Hiter. |
---|
446 | function popupmenu_Hiter_Callback(hObject, eventdata, handles) |
---|
447 | % hObject handle to popupmenu_Hiter (see GCBO) |
---|
448 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
449 | % handles structure with handles and user data (see GUIDATA) |
---|
450 | |
---|
451 | % Hints: contents = get(hObject,'String') returns popupmenu_Hiter contents as cell array |
---|
452 | % contents{get(hObject,'Value')} returns selected item from popupmenu_Hiter |
---|
453 | |
---|
454 | val = get(hObject,'Value'); |
---|
455 | |
---|
456 | handles.Hiter = val; |
---|
457 | % Update handles structure |
---|
458 | guidata(hObject, handles); |
---|
459 | |
---|
460 | pushbutton_Hfind_Callback(handles.pushbutton_Hfind, eventdata, handles); |
---|
461 | % plotHdata(hObject, handles); |
---|
462 | |
---|
463 | % --- Executes during object creation, after setting all properties. |
---|
464 | function popupmenu_Hiter_CreateFcn(hObject, eventdata, handles) |
---|
465 | % hObject handle to popupmenu_Hiter (see GCBO) |
---|
466 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
467 | % handles empty - handles not created until after all CreateFcns called |
---|
468 | |
---|
469 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
470 | % See ISPC and COMPUTER. |
---|
471 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
472 | set(hObject,'BackgroundColor','white'); |
---|
473 | end |
---|
474 | |
---|
475 | |
---|
476 | % --- Executes on selection change in popupmenu_Viter. |
---|
477 | function popupmenu_Viter_Callback(hObject, eventdata, handles) |
---|
478 | % hObject handle to popupmenu_Viter (see GCBO) |
---|
479 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
480 | % handles structure with handles and user data (see GUIDATA) |
---|
481 | |
---|
482 | % Hints: contents = get(hObject,'String') returns popupmenu_Viter contents as cell array |
---|
483 | % contents{get(hObject,'Value')} returns selected item from popupmenu_Viter |
---|
484 | |
---|
485 | val = get(hObject,'Value'); |
---|
486 | |
---|
487 | handles.Viter = val; |
---|
488 | % Update handles structure |
---|
489 | guidata(hObject, handles); |
---|
490 | |
---|
491 | pushbutton_Vfind_Callback(handles.pushbutton_Vfind, eventdata, handles); |
---|
492 | % plotHdata(hObject, handles); |
---|
493 | |
---|
494 | % --- Executes during object creation, after setting all properties. |
---|
495 | function popupmenu_Viter_CreateFcn(hObject, eventdata, handles) |
---|
496 | % hObject handle to popupmenu_Viter (see GCBO) |
---|
497 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
498 | % handles empty - handles not created until after all CreateFcns called |
---|
499 | |
---|
500 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
501 | % See ISPC and COMPUTER. |
---|
502 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
503 | set(hObject,'BackgroundColor','white'); |
---|
504 | end |
---|
505 | |
---|
506 | |
---|