source: MML/trunk/machine/SOLEIL/StorageRing/BBA/BBAgui_last.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 46.4 KB
Line 
1function BBAgui_last(arg1,arg2)
2%
3%
4%  See compteurBBA
5
6
7%% PARAMETRES DES PANELS:Dimensions
8fontsize=12;
9hradio=12;
10lradio=50;
11espV=10;
12espH=10;
13OffNone=20;
14
15%Panels "Qi" (pour servir des paramÚtres)
16lpanel=10*(lradio+espH/4)+OffNone+espH;
17mult=1;
18hpanel=mult*hradio+(mult+1)*espV+fontsize;
19hpospan=hpanel+espV;
20
21%Panel "ALL QP"
22lpanQP=2*(lradio+espH);
23hpanQP=2*hradio+2*espV+fontsize;
24
25%Panel "Plane"
26lpanPlane=2*(lradio+espH);
27hpanPlane= hpanQP;
28% checkbox: "Horizontal"
29lHrz=lradio+20;
30hHrz=hradio;
31
32% checkbox: "Vertical"
33lVert=lradio+10;
34hVert=hradio;
35
36%Panel "Method"
37lpanMeth=2.5*(lradio+espH);
38hpanMeth= hpanQP;
39
40% checkbox: "M.E.C."
41lMec=lradio+20 ;
42hMec=hradio;
43
44% checkbox: "BMP4CM"
45lBmp4cm=lradio+30;
46hBmp4cm=hradio;
47
48%Figure
49largeurFig=1.8*(10*(lradio+espH)+4*espH);%10*80+2*20;
50hauteurFig=20*hradio+32*espV+10*fontsize+10*espV+hpanQP+espV+fontsize;
51
52%Plot
53lPlot=largeurFig-lpanel-200;
54hPlot=0.4*hauteurFig;
55
56%pour les sextu
57larSp=largeurFig-lpanel-30;
58HautSp=2*hpanel+espV;
59
60
61% Zone de texte: Qp en cours de mesure
62lQpMes1= 6.5*lradio;
63hQpMes1=2*hradio;
64
65
66% Zone de texte BPM: utilisé
67lBpm=2*lradio+20;
68hBpm=2*hradio;
69
70% Zone de texte BPM: utilisé
71lcor=2*lradio+20;
72hcor=2*hradio;
73
74% Zone de texte: Qp mesuré précedemment
75lQpMes0= lBpm;
76hQpMes0= hBpm;
77
78% Zone de texte heure de la mesure précédente
79lClock=5*lradio;%+2*espH;
80hClock=hBpm;
81
82
83%Zone de texte:valeur offset BPM
84loff= 5*lradio;
85hoff=2*hradio;
86
87
88%Zone de texte:RMS Fit
89lrms= 11*lradio;
90hrms=2*hradio;
91
92%Zone de texte:Name File
93lfich=11*lradio;
94hfich=2*hradio;
95
96% Pushbutton pour lancer le BBA
97lBBA=3*lradio;
98hBBA=3*hradio;
99
100lmanu=1.2*lradio;
101hmanu=2*espV;
102
103lnbCor=lradio;
104hnbCor=2*espV;
105
106lStCor=lradio;
107hStCor=2*espV;
108
109lOffCor=lradio;
110hOffCor=2*espV;
111
112lDelais=lradio;
113hDelais=2*espV;
114
115lStQp=lradio;
116hStQp=2*espV;
117
118lWhCor=lradio;
119hWhCor=2*espV;
120
121%% PARAMETRES DES PANELS: Positions
122
123hposrad=(hpanPlane-fontsize-hradio)/2;
124
125%Panel "ALL QP"
126HposQp=10;
127VposQp=hauteurFig-hpanQP-10;
128
129%Panel "Plane"
130HposPlane=lpanQP+(lpanel-lpanQP-lpanMeth)/2-lpanPlane/2;
131VposPlane=hauteurFig-hpanPlane-10;
132
133% checkbox: "Horizontal"
134HHrz= 5;
135VHrz=hposrad;
136
137
138% checkbox: "Vertical"
139HVert=5+1*(lradio+espH)+10;
140VVert=hposrad;
141
142
143%Panel "Method"
144%HposMeth=HposPlane+espH+lpanPlane;
145HposMeth=10+lpanel-lpanMeth;%HposQp+10*(lradio+espH)+OffNone-lpanMeth;
146VposMeth=hauteurFig-hpanMeth-10;
147
148% checkbox: "M.E.C."
149HMec=5;
150VMec=hposrad;
151
152
153% checkbox: "BMP4CM"
154HBmp4cm=5+1.5*(lradio+espH)-20;
155VBmp4cm=hposrad;
156
157
158
159
160
161%pour les sextu
162HposSp=lpanel+20;
163VposSp=VposMeth-2*espV-hpanel-hpospan;%hauteurFig-4*(hpanel+espV)
164
165
166%Plot
167HposPlot=lpanel+(largeurFig-lpanel)/2-lPlot/2+espH;
168VposPlot=hauteurFig/2-125;
169
170% Zone de texte Qp en cours de mesure
171HQpMes1=lpanel+(largeurFig-lpanel)/2-lQpMes1/2;%+2*espH;
172VQpMes1=hauteurFig-5*espV;
173
174% Zone de texte BPM: utilisé
175HBpm=lpanel+(largeurFig-lpanel)/2+espH+lcor/2;
176VBpm=13*hposrad;
177
178% Zone de texte COR: utilisé
179Hcor=lpanel+(largeurFig-lpanel)/2-lcor/2;
180Vcor=13*hposrad;
181
182% Zone de texte Qp mesuré précedemment
183HQpMes0=lpanel+(largeurFig-lpanel)/2-lQpMes0-espH-lcor/2;%+2*espH;
184VQpMes0=VBpm;
185
186% Zone de texte heure de la mesure précédente
187HClock=lpanel+(largeurFig-lpanel)/2-lClock/2;%+lcor/2+lBpm+2*espH;%+2*espH;
188VClock=VBpm+hClock+espV;
189
190%Zone de texte:valeur offset BPM
191Hoff=lpanel+(largeurFig-lpanel)/2-loff/2;
192Voff=10*hposrad;
193
194%Zone de texte:RMS Fit
195Hrms=lpanel+(largeurFig-lpanel)/2-lrms/2;
196Vrms=hauteurFig-6*espV-hQpMes1;
197
198%Zone de texte:Name File
199Hfich=lpanel+(largeurFig-lpanel)/2-lfich/2;
200Vfich=hauteurFig-7*espV-2*hrms;
201
202% Pushbutton pour lancer le BBA
203HBBA=lpanel+(largeurFig-lpanel)/2-lBBA/2;
204VBBA=50;
205
206
207Hmanu=largeurFig-1.1*lradio-espV;
208Vmanu=150;
209
210HnbCor=largeurFig-lradio-espV;
211VnbCor=125;
212
213
214HStCor=largeurFig-lradio-espV;
215VStCor=100;
216
217HOffCor=largeurFig-lradio-espV;
218VOffCor=75;
219
220HDelais=largeurFig-lradio-espV;
221VDelais=50;
222
223HStQp=largeurFig-lradio-espV;
224VStQp=25;
225
226HWhCor1=largeurFig-3*(lradio-espV)-espV;
227VWhCor1=25;
228
229HWhCor2=largeurFig-4*(lradio-espV)-2*espV;
230VWhCor2=25;
231%%5+2*(lradio+espH)+10
232
233
234%%5+2*(lradio+espH)+10
235
236
237if nargin<1 %Créer l'IHM
238
239    delete(findobj(allchild(0),'Tag','Ola')); % detruit interface si existe deja
240    for i=1:10
241        QuadFamilyList(i)=cellstr(strcat('Q',num2str(i)));
242    end
243
244    % ParamÚtres des éléments de l'IHM
245
246    %% FIGURE
247    figCol=[0.93,0.75,0.51];
248    f = figure( 'Visible','on',...
249        'Units','pixels',...
250        'Position',[100,100,largeurFig,hauteurFig],...
251        'HandleVisibility','on',...
252        'Name','B.B.A. -> Offsets Hunting',...
253        'Tag','Ola',...
254        'Color',[0.93,0.75,0.51]);
255    %%
256    %% AXE = Plots
257    Hb=axes('Parent',f);
258    set(Hb,'Units','pixels');
259    set(Hb,'Tag','merit_Plot');
260
261    get(Hb,'Tag');
262    %         alors=get(Hb,'Position')
263    set(Hb,'Position',[HposPlot VposPlot lPlot hPlot]);
264
265    ze=[0 0];ord2=[0 0];ord1=[0 0];
266    CorCons=[0 0];BpmRes=[0 0];merit(:,1)=[0 0];merit(:,2)=[0 0];
267    center=0; y1=[-1 1];x1=[-1 1];offs=0;y2=[-2 2];
268    hold on
269    [Bx1,Hb1,Hb2]=plotyy(Hb,ze,ord2,ze,ord1,'plot');
270    set(Bx1(1),'Tag','axe_calc_bpm');
271    set(Bx1(2),'Tag','axe_calc_merit');
272    set(Hb1,'Tag','calc_bpm');
273    set(Hb2,'Tag','calc_merit');
274
275    set(Hb1,'Color','black','LineStyle','-.');%,'LineStyle','--')
276    set(Hb2,'Color','black','LineStyle','-.');
277    %set(Bx1(1),'YLim',y1);
278    %set(Bx1(2),'YLim',y2);
279    axis(Bx1(1),'off');
280    axis(Bx1(2),'off');
281
282    [Ax1,Ha1,Ha2]=plotyy(Hb,CorCons,BpmRes,merit(:,1),merit(:,2) ,'plot');
283    set(Ax1(1),'Tag','axe_mes_bpm');
284    set(Ax1(2),'Tag','axe_mes_merit');
285    set(Ha1,'Tag','mes_bpm');
286    set(Ha2,'Tag','mes_merit');
287
288    set(Ha1,'Marker','x','Color','blue');%,'LineStyle','--')
289    set(Ha2,'Marker','x','Color','red');
290
291    %x1=get(Ax1(1),'XLim');
292    %set(Ax1,'Visible','off');
293    %set(Ax1(1),'YLim',y1);
294    %set(Ax1(2),'YLim',y2);
295    axis(Ax1(1),'on')
296    axis(Ax1(2),'on');
297    %set(Ax1(1),'YLim',y1,'YColor','blue');
298    %set(Ax1(2),'YLim',y2,'YColor','red');
299    set(Ax1(1),'YColor','blue');
300    set(Ax1(2),'YColor','red');
301
302    set(get(Ax1(1),'XLabel'),'String','COR Value (amps)');
303    set(get(Ax1(1),'YLabel'),'String','(mm)');
304    set(get(Ax1(2),'YLabel'),'String','(mm^2)');
305
306    pl1=plot(Hb,[center center],[-1 0],'k','LineStyle','-.');
307    pl2=plot(Hb,[-1 center],[offs offs],'k','LineStyle','-.');
308    pl3=plot(Hb,center,offs,'ko');
309    set(pl1,'Tag','loc_off1');
310    set(pl2,'Tag','loc_off2');
311    set(pl3,'Tag','loc_off3');
312    drawnow
313    hold off
314
315    %         [Ax1,Ha1,Ha2]=plotyy(Hb,[1 3 9],[4 5 8],[4 7 12],[1 2 3])
316    %         set(Ha1,'Marker','x','Color','blue');
317    %         set(Ha2,'Marker','x','Color','red');
318    %         hold on
319    %         axis(Ax1,'off')
320    %         [Bx1,Hb1,Hb2]=plotyy(Hb,[12 20 45],[4 10 -6],[0 2 41],[1 -20 3])
321    %         axis(Bx1,'on')
322    %         hold off
323
324
325    %     f2=uipanel( 'Parent',f,'BackgroundColor',[0.93,0.75,0.51],...
326    %                 'Visible','on',...
327    %                 'Units','pixels',...
328    %                 'Position',[0,0,lpanel+20,hauteurFig],...
329    %                 'HandleVisibility','on',...
330    %                 'Visible','on');
331
332
333    %%
334    Hdecale=lradio+espH;
335    % radio bouton manuel ou auto
336    radManu=uicontrol('Parent',f,...
337        'BackgroundColor',[1,0,0],...
338        'Style','radiobutton',...
339        'String', 'Manual',...
340        'Units','pixels',...
341        'Callback',     'BBAgui_last(''manu'')',...
342        'Tag',   'radio_manu',...
343        'Value',0,...
344        'Position',[Hmanu Vmanu lmanu hmanu]);
345
346    edNbCor=uicontrol('Parent',f,...
347        'BackgroundColor',[1 1 1],...
348        'Style','edit',...
349        'String', '13',...
350        'Units','pixels',...
351        'Callback',      '',...
352        'Tag',   'edit_nbCor',...
353        'Value',0,...
354        'Position',[HnbCor VnbCor lnbCor hnbCor]);
355
356    edStepCor=uicontrol('Parent',f,...
357        'BackgroundColor',[1 1 1],...
358        'Style','edit',...
359        'String', '0.1',...
360        'Units','pixels',...
361        'Callback',      '',...
362        'Tag',   'edit_StCor',...
363        'Value',0,...
364        'Position',[HStCor VStCor lStCor hStCor]);
365
366    edOffCor=uicontrol('Parent',f,...
367        'BackgroundColor',[1 1 1],...
368        'Style','edit',...
369        'String', '0',...
370        'Units','pixels',...
371        'Callback',      '',...
372        'Tag',   'edit_OffCor',...
373        'Value',0,...
374        'Position',[HOffCor VOffCor lOffCor hOffCor]);
375
376    edDelais=uicontrol('Parent',f,...
377        'BackgroundColor',[1 1 1],...
378        'Style','edit',...
379        'String', '3',...
380        'Units','pixels',...
381        'Callback',      '',...
382        'Tag',   'edit_Delais',...
383        'Value',0,...
384        'Position',[HDelais VDelais lDelais hDelais]);
385
386    edStQp=uicontrol('Parent',f,...
387        'BackgroundColor',[1 1 1],...
388        'Style','edit',...
389        'String', '1.75',...
390        'Units','pixels',...
391        'Callback',      '',...
392        'Tag',   'edit_StQp',...
393        'Value',0,...
394        'Position',[HStQp VStQp lStQp hStQp]);
395
396    edWhCor=uicontrol('Parent',f,...
397        'BackgroundColor',[1 1 1],...
398        'Style','edit',...
399        'String', '1',...
400        'Units','pixels',...
401        'Callback',      '',...
402        'Tag',   'edit_WhCor',...
403        'Value',0,...
404        'Position',[HWhCor2 VWhCor2 lStQp hStQp]);
405
406    %%
407    textNbCor=uicontrol('Parent',f,...
408        'BackgroundColor',figCol,...
409        'Style','text',...
410        'FontSize',12,...
411        'String', 'nb Cor',...
412        'Units','pixels',...
413        'Callback',      '',...
414        'Tag',   'text_nbCor',...
415        'Value',0,...
416        'Position',[HnbCor-Hdecale VnbCor lnbCor hnbCor]);
417
418    textStepCor=uicontrol('Parent',f,...
419        'BackgroundColor',figCol,...
420        'Style','text',...
421        'FontSize',12,...
422        'String', 'Step Cor',...
423        'Units','pixels',...
424        'Callback',      '',...
425        'Tag',   'text_StCor',...
426        'Value',0,...
427        'Position',[HStCor-Hdecale VStCor lStCor hStCor]);
428
429    textOffCor=uicontrol('Parent',f,...
430        'BackgroundColor',figCol,...
431        'Style','text',...
432        'FontSize',12,...
433        'String', 'Offs Cor',...
434        'Units','pixels',...
435        'Callback',      '',...
436        'Tag',   'text_OffCor',...
437        'Value',0,...
438        'Position',[HOffCor-Hdecale VOffCor lOffCor hOffCor]);
439
440    textDelais=uicontrol('Parent',f,...
441        'BackgroundColor',figCol,...
442        'Style','text',...
443        'FontSize',12,...
444        'String', 'Delai',...
445        'Units','pixels',...
446        'Callback',      '',...
447        'Tag',   'text_Delais',...
448        'Value',0,...
449        'Position',[HDelais-Hdecale VDelais lDelais hDelais]);
450
451    textStQp=uicontrol('Parent',f,...
452        'BackgroundColor',figCol,...
453        'Style','text',...
454        'FontSize',12,...
455        'String', 'Step Qp',...
456        'Units','pixels',...
457        'Callback',      '',...
458        'Tag',   'text_StQp',...
459        'Value',0,...
460        'Position',[HStQp-Hdecale VStQp lStQp hStQp]);
461
462    textWhCor=uicontrol('Parent',f,...
463        'BackgroundColor',figCol,...
464        'Style','text',...
465        'FontSize',12,...
466        'String', 'Choix Cor',...
467        'Units','pixels',...
468        'Callback',      '',...
469        'Tag',   'text_WhCor',...
470        'Value',0,...
471        'Position',[HWhCor2-Hdecale-espV VWhCor2 1.2*lWhCor hWhCor]);
472
473
474    %%   % PANEL pour sélectionner ou désélectionner tous les Qp
475    QpCol=[0.63,0.8,0.35];
476
477    AllQP=uipanel('Parent',f,...
478        'BackgroundColor',QpCol,...%[0,0.9,0.9]
479        'FontUnits','pixels',...
480        'FontWeight','bold',...
481        'FontSize',fontsize,...
482        'Title','ALL QP',...
483        'FontSize',12,...
484        'Units','pixels',...
485        'Position',[HposQp VposQp lpanQP hpanQP],...
486        'Visible','on');
487
488
489    hposrad=(hpanQP-fontsize-hradio)/2;
490
491    % radio button 'ALL'
492    radAll=uicontrol('Parent',AllQP,...
493        'BackgroundColor',QpCol,...
494        'Style','radiobutton',...
495        'String', 'ALL',...
496        'Units','pixels',...
497        'Callback',      'BBAgui_last(''typeAll'')',...
498        'Tag',   'radio_All',...
499        'Value',0,...
500        'Position',[5 hposrad lradio hradio]);
501
502    % radio button 'None'
503    radNone=uicontrol('Parent',AllQP,...
504        'BackgroundColor',QpCol,...
505        'Style','radiobutton',...
506        'String', 'None',...
507        'Units','pixels',...
508        'Callback',      'BBAgui_last(''typeNone'')',...
509        'Tag',   'radio_None',...
510        'Value',0,...
511        'Position',[5+lradio+espH/4 hposrad lradio hradio]);
512
513
514
515    %%  % PANEL pour sélectionner le plan de BBA
516    PlCol=[1,0.8,0];
517    panPlane=uipanel('Parent',f,...
518        'BackgroundColor',PlCol,...
519        'FontUnits','pixels',...
520        'FontWeight','bold',...
521        'FontSize',fontsize,...
522        'Title','Plane',...
523        'Units','pixels',...
524        'Position',[HposPlane VposPlane lpanPlane+20 hpanPlane],...
525        'Visible','on');
526
527    hposrad=(hpanPlane-fontsize-hradio)/2;
528    %             radAll=uicontrol('Parent',panPlane,...%[0.2,1,0]
529    %                     'BackgroundColor',PlCol,...
530    %                     'Style','radiobutton',...
531    %                     'String', 'Both',...
532    %                     'Units','pixels',...
533    %                     'Callback',      '',...
534    %                     'Tag',   'radioP_All_Plane',...
535    %                     'Value',0,...
536    %                     'Position',[5 hposrad lradio hradio]);
537
538    ckb_Hrz=uicontrol('Parent',panPlane,...
539        'BackgroundColor',PlCol,...
540        'Style','checkbox',...
541        'String', 'Horizontal',...
542        'Units','pixels',...
543        'Callback','BBAgui_last(''check'')',...
544        'Tag',  'ckboxP_Hrz',...
545        'Value',0,...
546        'Position',[HHrz VHrz lHrz hHrz]);
547
548    ckb_Vert=uicontrol('Parent',panPlane,...
549        'BackgroundColor',PlCol,...
550        'Style','checkbox',...
551        'String', 'Vertical',...
552        'Units','pixels',...
553        'Callback', 'BBAgui_last(''check'')',...
554        'Tag',  'ckboxP_Vert',...
555        'Value',0,...
556        'Position',[HVert VVert lVert hVert]);
557
558    %% % PANEL pour sélectionner la méthode de BBA
559
560    MetCol=[0.8,0.5,0.5];
561    panMeth=uipanel('Parent',f,...
562        'BackgroundColor',MetCol,...%[1,0.8,0]
563        'FontUnits','pixels',...
564        'FontWeight','bold',...
565        'FontSize',fontsize,...
566        'Title','Method',...
567        'FontSize',12,...
568        'Units','pixels',...
569        'Position',[HposMeth-10 VposMeth lpanMeth+10 hpanMeth],...
570        'Visible','on');
571
572
573    %            radAll_Meth=uicontrol('Parent',panMeth,...
574    %                     'BackgroundColor',MetCol,...
575    %                     'Style','radiobutton',...
576    %                     'String', 'Both',...
577    %                     'Units','pixels',...
578    %                     'Callback',      '',...
579    %                     'Tag',   'radioM_All_Meth',...
580    %                     'Value',0,...
581    %                     'Position',[5 hposrad lradio hradio]);
582
583    ckb_mec=uicontrol('Parent',panMeth,...
584        'BackgroundColor',MetCol,...
585        'Style','checkbox',...
586        'String', 'M.E.C.',...
587        'Units','pixels',...
588        'Callback',      '',...
589        'Tag',   'ckboxM_MEC',...
590        'Value',0,...
591        'Position',[HMec VMec lMec hMec]);
592
593    ckb_bmp=uicontrol('Parent',panMeth,...
594        'BackgroundColor',MetCol,...
595        'Style','checkbox',...
596        'String', 'Bump 4 CM',...
597        'Units','pixels',...
598        'Callback',      '',...
599        'Tag',  'ckboxM_BMP4CM',...
600        'Value',0,...
601        'Position',[HBmp4cm VBmp4cm lBmp4cm hBmp4cm]);
602
603
604
605    %% Panel pour les sextupoles
606    %    SpCol=[0.63,0.8,0.35];
607    %    panSp=uipanel('Parent',f,...
608    %        'BackgroundColor',SpCol,...%[1,0.8,0]
609    %        'FontUnits','pixels',...
610    %        'FontWeight','bold',...
611    %        'FontSize',fontsize,...
612    %        'Title','Sextu',...
613    %        'FontSize',12,...
614    %        'Units','pixels',...
615    %        'Position',[HposSp VposSp larSp HautSp],...
616    %        'Visible','on');
617
618
619    %% Bouton pour lancer le BBA
620    ActCol=[0.93,0.8,0.2];
621
622    PushAction=uicontrol('Parent',f,...
623        'BackgroundColor',ActCol,...
624        'Style','pushbutton',...
625        'String', 'ACTION',...
626        'Units','pixels',...
627        'Callback',      'BBAgui_last(''action'')',...
628        'Tag',   'push_Act',...
629        'Value',0,...
630        'Position',[HBBA VBBA lBBA hBBA]);
631    %% Zone de texte pour afficher le quadrupole en cours de mesure
632
633    TxtQp1=uicontrol(   'Parent',f,...%[0.2,1,0]
634        'BackgroundColor',[1,1,1],...
635        'Style','text',...
636        'FontSize',16,...
637        'String','Qp [cell elt]',...
638        'Units','pixels',...
639        'Callback',      '',...
640        'Tag',   'edit_work1',...
641        'Position',[HQpMes1 VQpMes1 lQpMes1 hQpMes1]);
642
643
644
645    %% Zone de texte pour afficher le quadrupole mesuré précedemment
646
647    TxtQp0=uicontrol(   'Parent',f,...%[0.2,1,0]
648        'BackgroundColor',[1,1,1],...
649        'Style','text',...
650        'FontSize',16,...
651        'String','Qp [cell elt]',...
652        'Units','pixels',...
653        'Callback',      '',...
654        'Tag',   'edit_work0',...
655        'Position',[HQpMes0 VQpMes0 lQpMes0 hQpMes0]);
656
657    %% Zone de texte pour afficher le BPM utilisé
658
659    TxtBpm=uicontrol(   'Parent',f,...%[0.2,1,0]
660        'BackgroundColor',[1,1,1],...
661        'Style','text',...
662        'FontSize',16,...
663        'String', 'BPM',...
664        'Units','pixels',...
665        'Callback',      '',...
666        'Tag',   'edit_BPM',...
667        'Position',[HBpm VBpm lBpm hBpm]);
668
669    %% Zone de texte pour afficher le COR utilisé
670
671    TxtBpm=uicontrol(   'Parent',f,...%[0.2,1,0]
672        'BackgroundColor',[1,1,1],...
673        'Style','text',...
674        'FontSize',16,...
675        'String', 'COR',...
676        'Units','pixels',...
677        'Callback',      '',...
678        'Tag',   'edit_COR',...
679        'Position',[Hcor Vcor lcor hcor]);
680
681    %% Zone de texte pour afficher l'heure de la mesure précédente
682
683    TxtClock=uicontrol(   'Parent',f,...%[0.2,1,0]
684        'BackgroundColor',figCol,...
685        'Style','text',...
686        'FontSize',16,...
687        'String', 'Clock',...
688        'Units','pixels',...
689        'Callback',      '',...
690        'Tag',   'edit_Clock',...
691        'Position',[HClock VClock lClock hClock]);
692
693    %% Zone de texte pour afficher la valeur de l'offset BPM
694
695    TxtOf=uicontrol(   'Parent',f,...%[0.2,1,0]
696        'BackgroundColor',[1,1,1],...
697        'Style','text',...
698        'FontSize',16,...
699        'FontWeight','bold',...
700        'String', 'Offset BPM',...
701        'Units','pixels',...
702        'Callback',      '',...
703        'Tag',   'edit_offset',...
704        'Position',[Hoff Voff loff hoff]);
705
706    %% Zone de texte pour la qualité du FIT
707
708    TxtFit=uicontrol(   'Parent',f,...%[0.2,1,0]
709        'BackgroundColor',[1,1,1],...
710        'Style','text',...
711        'FontSize',14,...
712        'FontWeight','bold',...
713        'String', 'RMS Fit',...
714        'Units','pixels',...
715        'Callback',      '',...
716        'Tag',   'edit_RMS',...
717        'Position',[Hrms Vrms lrms hrms]);
718
719    %% Zone de texte pour le nom du fichier
720    TxtFile=uicontrol(   'Parent',f,...%[0.2,1,0]
721        'BackgroundColor',[1,1,1],...
722        'Style','text',...
723        'FontSize',12,...
724        'FontWeight','bold',...
725        'String', 'Name File',...
726        'Units','pixels',...
727        'Callback',      '',...
728        'Tag',   'edit_File',...
729        'Position',[Hfich Vfich lfich hfich]);
730
731    %% Boucle pour créer les 160 checkbox, les 10 panels et les radiobutton associés
732    incr=0;
733    multpos=0;
734    hpospan=0;
735    for i=1:10%10
736        QuadDevList=getlist(char(QuadFamilyList(i)));
737        long=length(QuadDevList);
738        TitleOffset=0;
739
740        if long == 8
741            mult=1;
742        elseif long == 16
743            mult=2;
744        elseif long==24
745            mult=3;
746        end
747
748        multpos=multpos+mult;
749
750        hpanel=mult*hradio+(mult+1)*espV+fontsize;
751        %lpanel=10*(lradio+espH)+OffNone;
752        hpospan=hpospan+hpanel+espV;
753        % 10 Panel 'Qi'
754        hp(i) = uipanel('Parent',f,...
755            'BackgroundColor',QpCol,...
756            'FontUnits','pixels',...
757            'FontWeight','bold',...
758            'FontSize',fontsize,...
759            'Title',char(QuadFamilyList(i)),...
760            'FontSize',12,...
761            'Units','pixels',...
762            'Position',[10 hauteurFig-hpanQP-espV-hpospan-10 lpanel hpanel],...
763            'Visible','on');
764
765        NameQuadFamAll=['All ' char(QuadFamilyList(i))];
766        NameRadioAll=['radioQ_All_' char(QuadFamilyList(i))];
767
768        NameQuadFamNone=['None ' char(QuadFamilyList(i))];
769        NameRadioNone=['radioQ_None_' char(QuadFamilyList(i))];
770
771        hposrad=(hpanel-fontsize-hradio)/2;
772
773        % 10 radio button pour sélectionner les Qp par familles
774        radAll(i)=uicontrol('Parent',hp(i),...
775            'BackgroundColor',QpCol,...
776            'Style','radiobutton',...
777            'String', NameQuadFamAll,...
778            'Units','pixels',...
779            'Callback',      'BBAgui_last(''familyAll'')',...
780            'Tag',   NameRadioAll,...
781            'Value',0,...
782            'Position',[5 hposrad lradio+5 hradio]);
783
784        % 10 radio button pour désélectionner par familles
785        radNone(i)=uicontrol('Parent',hp(i),...
786            'BackgroundColor',QpCol,...
787            'Style','radiobutton',...
788            'String', NameQuadFamNone,...
789            'Units','pixels',...
790            'Callback',      'BBAgui_last(''familyNone'')',...
791            'Tag',   NameRadioNone,...
792            'Value',0,...
793            'Position',[5+lradio+espH/4 hposrad lradio+OffNone hradio]);
794
795        %% Boucle des checkbox
796        for j=1:length(QuadDevList)
797            QuadFamTot(j+incr)=QuadFamilyList(i);
798            QuadDevTot(j+incr,:)=QuadDevList(j,:);
799            ValueList(j+incr)=0;
800
801
802            NameQuadDev=char(['[' num2str(QuadDevList(j,1)) '_'  num2str(QuadDevList(j,2)) ']']);
803            NameControl=['ckbox_' char(QuadFamilyList(i)) '_' num2str(QuadDevList(j,1)) '_'  num2str(QuadDevList(j,2))];
804            if j>0 & j<=8
805                valjH=j;
806                valjV=1;
807            elseif j>8 & j<=16
808                valjH=j-8;
809                valjV=2;
810            elseif j>16 & j<=24
811                valjH=j-16;
812                valjV=3;
813            end
814            % N=8,16 or 24 pour sélectionner les Qp individuellement
815            cont(i,j)=uicontrol('Parent',hp(i),...
816                'BackgroundColor',QpCol,...
817                'Style','checkbox',...
818                'String', NameQuadDev,...
819                'Units','pixels',...
820                'Callback',   'BBAgui_last(''check'')'   ,...%'BBAgui_last(''Ncheck'')'
821                'Tag',   NameControl,...
822                'Value',ValueList(j+incr),...
823                'Position',[(valjH+1)*(lradio+espH/4)+OffNone hpanel-(valjV)*(hradio+espV)-espV lradio hradio]);
824            %'Position',[0 0-0.3*(j-1) 0.1 .1]);
825        end
826        %%
827        incr=incr+length(QuadDevList);
828
829    end
830
831    delete('guy*.mat')
832    save('guytrydata1.mat','QuadFamTot','QuadDevTot')
833    set(f,'Visible','on');
834
835    RepRes = find_directory;
836    setappdata(findobj(allchild(0),'Tag','Ola'),'RepRes',RepRes);
837
838   
839    %% Conditions sur les checkbox "[i j]"
840
841elseif strcmpi(arg1,'manu')  % bouton manuel/auto
842
843    autom=findobj('Style','radiobutton','-and','-regexp','Tag','radio_manu');
844    etat=get(autom,'Value');
845    if etat==1
846        set(autom,'Backgroundcolor',[0,1,0]);
847    elseif etat==0
848        set(autom,'Backgroundcolor',[1,0,0]);
849    end
850    %%
851elseif strcmpi(arg1,'action')  % ressortir les checkbox cochees
852    %delete('guytrydata2.mat')
853    clear list h lista;
854    % disp('ok!!')
855    f=findobj('Tag','Ola');
856    set(f,'Visible','on');
857    h=findobj('Style','checkbox','-and','-regexp','Tag','Q');
858
859    length(h);
860    k=1;
861    for i=1:length(h)
862        list(i)=get(h(i),'Value');
863        lista(i)=cellstr(get(h(i),'Tag'));
864        IDQuad=char(lista(i));
865       
866        % Ajout Laurent       
867        if strcmpi(IDQuad, 'checkbox_AllQuad') || strcmpi(IDQuad, 'checkbox_Q10') || ...
868                strcmpi(IDQuad, 'checkbox_Q9') || strcmpi(IDQuad, 'checkbox_Q8') || ...
869                strcmpi(IDQuad, 'checkbox_Q7') || strcmpi(IDQuad, 'checkbox_Q6') || ...
870                strcmpi(IDQuad, 'checkbox_Q5') || strcmpi(IDQuad, 'checkbox_Q4') || ...
871                strcmpi(IDQuad, 'checkbox_Q3') || strcmpi(IDQuad, 'checkbox_Q2') || ...
872                strcmpi(IDQuad, 'checkbox_Q1')
873            list(i)=0;
874        end
875        % Fin ajout Laurent.
876       
877        if list(i)==1
878            indstr=findstr(IDQuad,'_');
879            family(k)=cellstr(IDQuad(indstr(1)+1:indstr(2)-1));
880            cellule(k)=str2num(IDQuad(indstr(2)+1:indstr(3)-1));
881            element(k)=str2num(IDQuad(indstr(3)+1:length(IDQuad)));
882            QpDevList(k,1)=cellule(k);
883            QpDevList(k,2)=element(k);
884            k=k+1;
885        end
886
887    end
888    sum(list);
889    list;
890    lista;
891    length(list);
892    %connaitre la méthode utilisée
893    clear list1 h1 lista1 MetList;
894    f1=findobj('Tag','Ola');
895    h1=findobj('Style','checkbox','-and','-regexp','Tag','ckboxM');
896    MetList=cellstr('bad');
897    varMet=0;
898    for u=1:length(h1)
899        list1(u)=get(h1(u),'Value');
900        lista1(u)=cellstr(get(h1(u),'Tag'));
901        IDMeth=char(lista1(u));
902        if list1(u)==1
903            varMet=varMet+1;
904            indstr=findstr(IDMeth,'_');
905            MetList(varMet)=cellstr(IDMeth(indstr+1:length(IDMeth)));
906        end
907    end
908    if  strcmpi(char(MetList(1)),'bad');
909        MetList(1,:)=cellstr('MEC');
910        hp=findobj('-and','Style','checkbox','-and','-regexp','Tag','ckboxM_MEC');
911        set(hp,'Value',1);
912    end
913
914    %connaitre les plans utilisés
915    clear list2 h2 lista2 PlaneList0;
916    f=findobj('Tag','Ola');
917    h2=findobj('-and','Style','checkbox','-and','-regexp','Tag','ckboxP');
918    PlaneList0=-1;
919    varPl=0;
920    for v=1:length(h2)
921        list2(v)=get(h2(v),'Value');
922        lista2(v)=cellstr(get(h2(v),'Tag'));
923        IDPlane=char(lista2(v));
924        if list2(v)==1
925            varPl=varPl+1;
926            indstr=findstr(IDPlane,'_');
927            PlaneList(varPl)=IDPlane(indstr+1);
928            if     PlaneList(varPl)=='H'
929                PlaneList0(varPl)=1;
930            elseif PlaneList(varPl)=='V'
931                PlaneList0(varPl)=2;
932            end
933        end
934    end
935    %if length(PlaneList0)>1
936    %    PlaneList0=0;
937    if  PlaneList0(1)<0
938        PlaneList0=1;
939        hp=findobj('-and','Style','checkbox','-and','-regexp','Tag','ckboxP_H');
940        set(hp,'Value',1);
941    end
942
943 
944    %%
945    % Lancement du programme BBA
946    %Hb=findobj('Tag','merit_Plot');
947    %chHb=get(gca,'Children')
948
949
950    %while ~isempty(chHb)
951    %chHb=get(Hb,'Children')
952
953
954    %pause(1)
955    %cla(chHb(1))
956    %cla(chHb(2))
957    % cla(chHb(3))
958    % cla(chHb(4))
959    % cla(chHb(5))
960
961
962    %end
963    %cla(Bx1(2))
964    %cla(Ax1(1))
965    %cla(Ax1(2))
966
967    G1=findobj('Tag','Ola');
968    child_handles = get(G1,'Children');
969    %get(child_handles,'Type');
970    G1=findobj('Tag','merit_Plot');
971    set(G1,'NextPlot','replace');
972    hold off
973    pause(5)
974    format long
975    PlaneList0;
976    MetList;
977    family;
978    cellule;
979    element;
980    QpDevList;
981    longElem=size(element);
982    indice=10; %indice permet de numeroter les figures
983    for w=1:length(family)
984        %indice=indice+1;
985        for loop=1:length(PlaneList0)
986            if PlaneList0(loop)==1
987                TextBpm='BPMx';
988                TextDel=char('Delta_X=');
989                TextCor='HCOR';
990            elseif PlaneList0(loop)==2
991                TextDel=char('Delta_Z=');
992                TextBpm='BPMz';
993                TextCor='VCOR';
994            end
995
996
997            pause(1);
998            danow= datestr(now);
999            %clear Ax1 Bx1 Ha1 Ha2 Hb1 Hb2
1000
1001            % écriture dans les zones de texte
1002            f=findobj('Style','text','-and','-regexp','Tag','edit_work1');
1003            TextQp1=char([char(family(w))   '  [' num2str(QpDevList(w,1)) ' ' num2str(QpDevList(w,2)) ']  @  ' danow]);
1004            set(f,'String',TextQp1);
1005
1006            %recherche de paramÚtres
1007            %Automatisation
1008            autom=findobj('Style','radiobutton','-and','-regexp','Tag','radio_manu');
1009            etat=get(autom,'Value');
1010            if etat==1
1011                maxloop=1;
1012            elseif etat==0
1013                maxloop=2;
1014                nbDeltaCor=3;
1015                OffCor=0;
1016                StepCor=1.2;
1017                %Delais=3.; % modification si nécessaire
1018                Delais=6.; % essai le 23 juin 08
1019                StepQp=2.5;
1020            end
1021
1022
1023
1024            for t=1:maxloop
1025                autom=findobj('Style','radiobutton','-and','-regexp','Tag','radio_manu');
1026                etat=get(autom,'Value');
1027                if etat==1
1028                    set(autom,'Backgroundcolor',[0,1,0]);
1029                    ed1=findobj('Style','edit','-and','-regexp','Tag','edit_nbCor');
1030                    nbDeltaCor=str2num(get(ed1,'String'));
1031
1032                    ed2=findobj('Style','edit','-and','-regexp','Tag','edit_StCor');
1033                    StepCor=str2num(get(ed2,'String'));
1034
1035                    ed3=findobj('Style','edit','-and','-regexp','Tag','edit_OffCor');
1036                    OffCor=str2num(get(ed3,'String'));
1037
1038                    ed4=findobj('Style','edit','-and','-regexp','Tag','edit_Delais');
1039                    Delais=str2num(get(ed4,'String'));
1040
1041                    ed5=findobj('Style','edit','-and','-regexp','Tag','edit_StQp');
1042                    StepQp=str2num(get(ed5,'String'));
1043
1044                else
1045                    set(autom,'Backgroundcolor',[1,0,0])
1046                    ed1=findobj('Style','edit','-and','-regexp','Tag','edit_nbCor');
1047                    TextnbDeltaCor=num2str(nbDeltaCor);
1048                    set(ed1,'String',TextnbDeltaCor);
1049
1050                    ed2=findobj('Style','edit','-and','-regexp','Tag','edit_StCor');
1051                    TextStepCor=num2str(StepCor);
1052                    set(ed2,'String',TextStepCor);
1053
1054                    ed3=findobj('Style','edit','-and','-regexp','Tag','edit_OffCor');
1055                    TextOffCor=num2str(OffCor);
1056                    set(ed3,'String',TextOffCor);
1057
1058                    ed4=findobj('Style','edit','-and','-regexp','Tag','edit_Delais');
1059                    TextDelais=num2str(Delais);
1060                    set(ed4,'String',TextDelais);
1061
1062                    ed5=findobj('Style','edit','-and','-regexp','Tag','edit_StQp');
1063                    TextStepQp=num2str(StepQp);
1064                    set(ed5,'String',TextStepQp);
1065                end
1066                ed6=findobj('Style','edit','-and','-regexp','Tag','edit_WhCor');
1067                CorNumber=str2num(get(ed6,'String'));
1068
1069                %edit_WhCor
1070
1071                drawnow
1072                RepRes = getappdata(findobj(allchild(0),'Tag','Ola'),'RepRes');
1073                [merit,CorCons,BpmRes,offs,OffsCor,center,ze,ord1,ord2,BpmDevRes,CorDevRes,iniCor,rmsFit,NameFile,NameFilePNG] = ...
1074                    bba_last(RepRes,family(w),QpDevList(w,:), PlaneList0(loop),char(MetList),nbDeltaCor,StepCor,OffCor,Delais,StepQp,CorNumber);
1075                %center
1076
1077                %         G1=findobj('Tag','merit_Plot');
1078                %         axes(G1);
1079                %         cla
1080                %         G1=findobj('Tag','Ola');
1081
1082                %        load('resu.mat')
1083                %        trace_bba.m
1084
1085                %CorCons=CorCons-iniCor;
1086                %CorCons=CorCons-iniCor;
1087                %center=center-iniCor;
1088
1089                droite=polyfit(CorCons,BpmRes,1);
1090                %BpmDevRes=[1 5];
1091
1092                TextCor1=char([TextCor ' [' num2str(CorDevRes(1,1)) '  ' num2str(CorDevRes(1,2)) ']']);
1093                f=findobj('Style','text','-and','-regexp','Tag','edit_COR');
1094                %TextOff2=char(['RMS Fit:  ' Textrms ' mm^2']);
1095                set(f,'String',TextCor1);
1096
1097                Textrms=num2str(round(rmsFit*10000000)/10000000);
1098                Delta1=merit(1,2);
1099                Delta2=merit(length(merit),2);
1100                TextDelta1=num2str(round(Delta1*100000)/100000);
1101                TextDelta2=num2str(round(Delta2*100000)/100000);
1102                f=findobj('Style','text','-and','-regexp','Tag','edit_RMS');
1103                TextOff2=char(['RMS Fit:  ' Textrms ' mm^2 | Min: ' TextDelta1 ' mm^2 | Max: ' TextDelta2 ' mm^2']);
1104                set(f,'String',TextOff2);
1105
1106                f=findobj('Style','text','-and','-regexp','Tag','edit_File');
1107                TextOff3=char([NameFile]);
1108                set(f,'String',TextOff3);
1109
1110                f=findobj('Style','text','-and','-regexp','Tag','edit_offset');
1111                TextOff1=char(['Offset ' TextBpm]);
1112                set(f,'String',TextOff1);
1113
1114                f=findobj('Style','text','-and','-regexp','Tag','edit_BPM');
1115                TextOff2=char([TextBpm ' [' num2str(BpmDevRes(1,1)) '  ' num2str(BpmDevRes(1,2)) ']'] );
1116                set(f,'String',TextOff2);
1117
1118                f=findobj('Style','text','-and','-regexp','Tag','edit_work0');
1119                TextQp0=char([char(family(w))   '  [' num2str(QpDevList(w,1)) ' ' num2str(QpDevList(w,2)) ']']);%  @  ' danow(13:length(danow))]);
1120                set(f,'String',TextQp0);
1121
1122                f=findobj('Style','text','-and','-regexp','Tag','edit_Clock');
1123                TextClock=char(danow);%  @  ' danow(13:length(danow))]);
1124                set(f,'String',TextClock);
1125                clear x1 y1 y2
1126
1127
1128                x1=[min(CorCons)-0.1-iniCor max(CorCons)+0.1-iniCor];
1129                deltay11=max(BpmRes)-min(BpmRes);
1130                y11=[min(BpmRes) max(BpmRes)];
1131                y12=[min(ord2) max(ord2)];
1132                y1=[min([y11(1) y12(1)])-0.01*deltay11 max([y11(2) y12(2)])+0.01*deltay11];
1133
1134                deltay21=max(merit(:,2))-min(merit(:,2));
1135                y21=[min(merit(:,2)) max(merit(:,2))];
1136                y22=[min(ord1) max(ord1)];
1137                y2=[min([y21(1) y22(1)])-0.01*deltay21 max([y21(2) y22(2)])+0.01*deltay21];
1138                G1=findobj('Tag','Ola');%,'-and','Tag','merit_Plot')
1139                drawnow
1140                Hb=findobj('Parent',G1,'-and','Tag','merit_Plot');
1141                %cla(Hb)
1142                %hold(Hb,'off')
1143                %Hb=findobj('Parent',G1,'-and','Tag','merit_Plot')
1144
1145                %pl3=plot(Hb,center,offs,'Marker','o','Color','black');
1146                %Hb=findobj('Parent',G1,'-and','Tag','merit_Plot')
1147                % hold(Hb,'on')
1148                %Hb=findobj('Parent',G1,'-and','Tag','merit_Plot')
1149                %Hb=axes('Parent',f)
1150                set(Hb,'Units','pixels');
1151                %hold on
1152                alors=get(Hb,'Position');
1153                %set(Hb,'Position',[900 520 550 400]);
1154                set(Hb,'Color','w');
1155
1156                %[Bx1,Hb1,Hb2]=plotyy(Hb,ze,ord2,ze,ord1,'plot');
1157                Bx11=findobj('Tag','axe_calc_bpm');
1158                set(Bx11,'YLim',y1);
1159                set(Bx11,'XLim',x1);
1160
1161                Bx12=findobj('Tag','axe_calc_merit');
1162                set(Bx12,'XLim',x1);
1163                set(Bx12,'YLim',y2);
1164
1165                Hb1=findobj('Tag','calc_bpm');
1166                set(Hb1,'XData',ze-iniCor,'YData',ord2);
1167                Hb2=findobj('Tag','calc_merit');
1168                set(Hb2,'XData',ze-iniCor,'YData',ord1);
1169
1170
1171                drawnow
1172                G1=findobj('Tag','Ola');
1173
1174
1175                drawnow
1176                %        [Ax1,Ha1,Ha2]=plotyy(Hb,CorCons,BpmRes,merit(:,1),merit(:,2) ,'plot');%,'Marker','x','Color','red')
1177                %refreshdata(Ax1)
1178                Ax11=findobj('Tag','axe_mes_bpm');
1179                set(Ax11,'XLim',x1);
1180                set(Ax11,'YLim',y1);
1181
1182
1183                Ax12=findobj('Tag','axe_mes_merit');
1184                set(Ax12,'XLim',x1);
1185                set(Ax12,'YLim',y2);
1186
1187
1188                Ha1=findobj('Tag','mes_bpm');
1189                set(Ha1,'XData',CorCons-iniCor,'YData',BpmRes);
1190
1191                Ha2=findobj('Tag','mes_merit');
1192                set(Ha2,'XData',merit(:,1)-iniCor,'YData',merit(:,2));
1193
1194                drawnow
1195
1196                ploRes1=findobj('Tag','loc_off1');
1197                ploRes2=findobj('Tag','loc_off2');
1198                ploRes3=findobj('Tag','loc_off3');
1199                set(ploRes1,'XData',[center-iniCor center-iniCor],'YData',[y1(1) offs]);
1200                set(ploRes2,'XData',[x1(1) center-iniCor],'YData',[offs offs]);
1201                set(ploRes3,'XData',center-iniCor,'YData',offs);
1202                disp(merit(:,2))
1203                % %         set(Ha1,'Marker','x','Color','blue');%,'LineStyle','--')
1204                % %         set(Ha2,'Marker','x','Color','red');
1205                % %
1206                % %         x1=get(Ax1(1),'XLim');
1207                % %         %set(Ax1,'Visible','off');
1208                %set(Ax11,'YLim',y1);
1209                %set(Ax12,'YLim',y2);
1210                %set(Ax11,'XLim',x1);
1211                %set(Ax12,'XLim',x1);
1212                %        axis(Ax11,'on')
1213                %       axis(Ax12,'on');
1214                % %         set(Ax1(1),'YLim',y1,'YColor','blue');
1215                % %         set(Ax1(2),'YLim',y2,'YColor','red');
1216                % %         if w==1
1217                % %             set(get(Ax1(1),'XLabel'),'String','COR Value (amps)');
1218                % %             set(get(Ax1(1),'YLabel'),'String','(mm)');
1219                % %             set(get(Ax1(2),'YLabel'),'String','(mm^2)');
1220                % %         end
1221
1222                %pl1=plot(Hb,[center center],[y1(1) offs],'k',[x1(1) center],[offs offs],'k',center,offs,'ko','LineStyle','-.');
1223                %       G1=findobj('Tag','Ola');
1224                %   child_handles = get(G1,'Children');
1225                %   get(child_handles,'Type');
1226                %pl2=plot(Hb,[x1(1) center],[offs offs],'Color','black','LineStyle','-.');
1227                %pl3=plot(Hb,center,offs,'Marker','o','Color','black');%,text(center,offs,'\leftarrow ',...
1228
1229
1230                %'HorizontalAlignment','left'))
1231                %axis(pl1,'off');
1232                %axis(pl2,'off');
1233                %axis(pl3,'off');
1234
1235                %set(pl1 ,'Color','black','LineStyle','-.');
1236                %set(pl2 ,'Color','black','LineStyle','-.');
1237 %sept
1238
1239
1240                %set(pl1,'YLim',y1);
1241                %set(pl2,'YLim',y1);
1242                %set(pl3,'YLim',y1);
1243
1244                %xlabel('COR Value (amps)')
1245                %ylabel(Bx1(1),'(mm)')
1246                %ylabel(Bx1(2),'(merit)')
1247                drawnow;
1248                % hold off
1249                pause(2)
1250                Hb=findobj('Tag','merit_Plot');
1251
1252                drawnow
1253                f=findobj('Style','text','-and','-regexp','Tag','edit_offset');
1254                offs1=round(100000*offs)/100;
1255                TextOff=char([TextDel num2str(offs1) ' µm']);
1256                set(f,'String',TextOff);
1257                %plot(Hb,[4 7 12],[1 2 3])
1258                drawnow
1259                testmerit=(merit(1,2)+merit(length(merit),2));
1260
1261                %mult=(0.01/testmerit)^(1/4); % formule Arnaud
1262                %mult=(0.01/testmerit)^(1/8); % modification 9 septembre Ludo MAT
1263                mult=0.5*(0.01/testmerit)^(1/16); % modification 14 octobre MAT
1264                DeltaCorMax=nbDeltaCor*StepCor*mult;
1265               
1266                nbDeltaCor=13;  %  attention peut etre modifie plus bas
1267               
1268                StepCor=DeltaCorMax/(nbDeltaCor-1); %
1269               
1270                %%modification MAT septembre 07 
1271                %% 1Úre modif 9 septembre : Diminuer le pas du correcteur
1272                %FAC_COR = 3 ; % Diminution par le facteur FAC_COR
1273                %StepCor=DeltaCorMax/(nbDeltaCor-1)/ FAC_COR;
1274               
1275                %% 2Úme modif à la suite : diminuer le nombre de pas
1276                nb_points_en_moins = 4 ;
1277                nbDeltaCor=13 - nb_points_en_moins;
1278                %StepCor=DeltaCorMax/(nbDeltaCor + nb_points_en_moins-1)/FAC_COR;
1279               
1280                OffCor=OffsCor;
1281                StepQp=StepQp*mult;
1282
1283                TextQp0=char([char(family(w))   '  [' num2str(QpDevList(w,1)) ' ' num2str(QpDevList(w,2)) ']']);
1284                disp(TextQp0)
1285
1286                TextOff2=char([TextBpm ' [' num2str(BpmDevRes(1,1)) '  ' num2str(BpmDevRes(1,2)) ']'] );
1287                disp(TextOff2)
1288
1289                TextOff=char([TextDel num2str(offs1) ' µm']);
1290                disp(TextOff)
1291
1292                TextCor1=char([TextCor ' [' num2str(CorDevRes(1,1)) '  ' num2str(CorDevRes(1,2)) ']']);
1293                disp(TextCor1)
1294
1295            end
1296
1297
1298        end
1299        %f=findobj('Tag','Ola');
1300        %saveas(f,NameFilePNG,'png')
1301    end
1302
1303    %%
1304elseif strcmpi(arg1,'check')
1305
1306
1307    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1308    % Exclusion entre checkbox=1 et None=1
1309    hNone=findobj('Style','radiobutton','-and','-regexp','Tag','None');
1310    set(hNone,'Value',0);
1311    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1312    %save('guytrydata2.mat','list','family','cellule','element');
1313    %axes(handles.offset);
1314    %axes('Position',[600 200 300 100]);
1315
1316
1317    %% Conditions sur les boutons radio "radioQ_Qi"
1318elseif strcmpi(arg1,'familyAll') | strcmpi(arg1,'familyNone')
1319    disp('c bon')
1320    familyType(arg1);
1321    BBAgui_last('check');
1322
1323    %% Conditions sur le bouton radio "radio_ALL"
1324elseif strcmpi(arg1,'typeAll') | strcmpi(arg1,'typeNone')
1325    disp('c bon')
1326    familyType(arg1);
1327    whi=['family' arg1(5:length(arg1))];
1328    BBAgui_last(whi);
1329
1330    %elseif strcmpi(arg1,'tex')
1331
1332end
1333%%
1334
1335end
1336
1337
1338
1339
1340%% fonction qui permet de gérer à la fois les radioboutons "radioQ_Qi" et "radio_ALL"
1341function familyType(tor)
1342%type=tor(7:length(tor))
1343disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
1344tor;
1345strmatch('family',tor);
1346cas=~isempty(strmatch('family',tor));
1347
1348if cas==1 %family
1349    prefix='radioQ_';
1350    type=tor(7:length(tor));
1351    button1='ckbox_';
1352    button2='';
1353    index=2;
1354    button3='_';
1355    style='checkbox';
1356else%total
1357    prefix='radio_';
1358    type=tor(5:length(tor));
1359    button1='radioQ_';
1360    button2=[type '_'];
1361    button3='';
1362    style='radiobutton';
1363    index=1;
1364end
1365
1366if strcmpi(type,'All');
1367    type1='All';
1368    type0='None';
1369    val=1;
1370else
1371    type1='None';
1372    type0='All';
1373    val=0;
1374    button1='ckbox_';
1375    button2='';
1376    index=2;
1377    button3='_';
1378    style='checkbox';
1379end
1380objTagTot0=['radio_' type0];
1381hobjectTot0=findobj('Style','radiobutton','-and','Tag',objTagTot0);
1382set(hobjectTot0,'Value',val);
1383
1384objTagFam1=['radioQ_' type1];
1385hobjectFam1=findobj('Style','radiobutton','-and','-regexp','Tag',objTagFam1);
1386
1387objTagFam0=['radioQ_' type0];
1388hobjectFam0=findobj('Style','radiobutton','-and','-regexp','Tag',objTagFam0);
1389k=1;
1390
1391for i=1:length(hobjectFam1)
1392    if cas==1
1393        list(i)=get(hobjectFam1(i),'Value');
1394    else
1395        list(i)=1;
1396    end
1397    lista(i)=cellstr(get(hobjectFam1(i),'Tag'));
1398    IDFam=char(lista(i));
1399    if list(i)==1
1400        indstr=findstr(IDFam,'Q');
1401        family(k)=cellstr(IDFam(indstr(2):length(IDFam)));
1402
1403        TagFind=[button1 button2 char(family(k)) button3];
1404        TagFindRad=['radioQ_' type0 '_' char(family(k))];
1405
1406        chkb=findobj('Style',style,'-and','-regexp','Tag',TagFind);
1407        radQ=findobj('Style','radiobutton','-and','-regexp','Tag',TagFindRad);
1408        set(radQ,'Value',0);
1409        for j=1:length(chkb)
1410            set(chkb(j),'Value',val);
1411        end
1412        k=k+1;
1413    end
1414
1415end
1416end
1417% elseif strcmpi(arg1,'familyNone') %en fct des radiobuton All Qi cochï¿œs, cocher les checkbox des familles Qi
1418%     f=findobj('Name','Ola');
1419%
1420%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1421%     % Exclusion entre radioQ_Qi=1 et radio_None=1
1422%     hAll=findobj('Style','radiobutton','-and','Tag','radio_ALL');
1423%     set(hAll,'Value',0);
1424%     hNoneFam=findobj('Style','radiobutton','-and','-regexp','Tag','radioQ_None')
1425%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%nteger (element number) in the RING
1426%     hNoneFam=findobj('Style','radiobutton','-and','-regexp','Tag','radioQ_None');
1427%     hAllFam =findobj('Style','radiobutton','-and','-regexp','Tag','radioQ_All');
1428%     %hAllFam=findobj('Style','radiobutton','-and','-regexp','Tag','radioQ_All');
1429%     length(hAllFam);
1430%     k=1;
1431%     for i=1:length(hNoneFam)
1432%         list(i)=get(hNoneFam(i),'Value');
1433%         lista(i)=cellstr(get(hNoneFam(i),'Tag'));
1434%         IDFam=char(lista(i));
1435%         if list(i)==1
1436%             indstr=findstr(IDFam,'Q');
1437%             family(k)=cellstr(IDFam(indstr(2):length(IDFam)));
1438%             TagFind=['ckbox_' char(family(k)) '_'];
1439%             TagFindRad=['radioQ_All_' char(family(k))];
1440%
1441%             chkb=findobj('Style','checkbox','-and','-regexp','Tag',TagFind);
1442%             radQ=findobj('Style','radiobutton','-and','-regexp','Tag',TagFindRad);
1443%             %radAll=findobj('Style','radiobutton','-and','-regexp','Tag','radio_ALL');
1444%             %set(radAll,'Value',0);
1445%             set(radQ,'Value',0)
1446%             for j=1:length(chkb)
1447%                 set(chkb(j),'Value',0);
1448%             end
1449%
1450%             %cellule(k)=str2num(IDQuad(indstr(2)+1:indstr(3)-1));
1451%             %element(k)=str2num(IDQuad(indstr(3)+1:length(IDQuad)));
1452%             k=k+1;
1453%         end
1454%
1455%     end
1456
1457function RepRes = find_directory
1458%% Mémorisation du répertoire de travail
1459Rep    = getfamilydata('Directory','BBA');
1460
1461Announcement = strcat('  ***        BBA  Registration Directory                             ***');
1462disp('  ****************************************************************************');
1463disp(Announcement);
1464disp('  **                                                                        **');
1465disp('  ****************************************************************************');
1466disp(' ')
1467disp('  ****************************************************************************');
1468disp('  **                             WARNING                                    **');
1469disp('  **    New directory has to be defined after an offset application         **');
1470disp('  **                                                                        **');
1471disp('  ****************************************************************************');
1472
1473button = questdlg('Is the BBA Registration Directory already existing ?','BBA Registration Directory','yes','no','yes') ;
1474if isequal(button,'yes')                            % la directory existe déjà
1475    RepRes = uigetdir(Rep);                         % choix de la directory
1476else
1477    tmp2 = questdlg('Create directory ?','BBA','Yes','No','Yes');
1478    if strcmpi(tmp2,'Yes')                          % create a new directory
1479        prompt = {'Enter new directory name:'};
1480        dlg_title = 'Input for Directory Name';
1481        num_lines = 1;
1482        def = {'2007-mois-jour'};
1483        answer = inputdlg(prompt,dlg_title,num_lines,def);
1484        RepRes = answer{1};
1485        cd(Rep)                                    % on se place dans la directory amont /BBA
1486        mkdir(RepRes)
1487        RepRes = [Rep RepRes]                      % Nom complet de la directory
1488    else                                           % alors on ne sait pas ce qu'on veut ??
1489        disp('**  BBA cancelled  **')
1490        return
1491    end
1492end
1493disp('  ** BBA starting **')
1494
1495end
Note: See TracBrowser for help on using the repository browser.