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