source: MML/trunk/machine/SOLEIL/common/naff/naffutils/resongui.m

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

To have a stable version on the server.

  • Property svn:executable set to *
File size: 25.2 KB
Line 
1function varargout = resongui(varargin)
2% RESONGUI M-file for resongui.fig
3%      RESONGUI, by itself, creates a new RESONGUI or raises the existing
4%      singleton*.
5%
6%      H = RESONGUI returns the handle to a new RESONGUI or the handle to
7%      the existing singleton*.
8%
9%      RESONGUI('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in RESONGUI.M with the given input arguments.
11%
12%      RESONGUI('Property','Value',...) creates a new RESONGUI or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before resongui_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to resongui_OpeningFcn via varargin.
17%
18%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
19%      instance to run (singleton)".
20%
21% See also: GUIDE, GUIDATA, GUIHANDLES
22
23% Edit the above text to modify the response to help resongui
24
25% Last Modified by GUIDE v2.5 16-Apr-2011 23:34:51
26
27% Begin initialization code - DO NOT EDIT
28gui_Singleton = 1;
29gui_State = struct('gui_Name',       mfilename, ...
30    'gui_Singleton',  gui_Singleton, ...
31    'gui_OpeningFcn', @resongui_OpeningFcn, ...
32    'gui_OutputFcn',  @resongui_OutputFcn, ...
33    'gui_LayoutFcn',  [] , ...
34    'gui_Callback',   []);
35if nargin & isstr(varargin{1})
36    gui_State.gui_Callback = str2func(varargin{1});
37end
38
39if nargout
40    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41else
42    gui_mainfcn(gui_State, varargin{:});
43end
44% End initialization code - DO NOT EDIT
45
46
47% --- Executes just before resongui is made visible.
48function resongui_OpeningFcn(hObject, eventdata, handles, varargin)
49% This function has no output args, see OutputFcn.
50% hObject    handle to figure
51% eventdata  reserved - to be defined in a future version of MATLAB
52% handles    structure with handles and user data (see GUIDATA)
53% varargin   command line arguments to resongui (see VARARGIN)
54
55% Choose default command line output for resongui
56handles.output = hObject;
57
58%Met la barre d'outil (zoom)
59set(hObject,'ToolBar','figure');
60
61% Update handles structure
62guidata(hObject, handles);
63
64%% Lit les donnees
65handles.pathname = pwd; %chemin de lancement
66handles.dataname = 'fmap.out'; % carte par defaut
67handles.color='off'; % carte en couleur avec diffusion
68handles.maptype = 'fmap'; %% fmap or fmapdp
69handles.data_inducedamplitude = fullfile(pwd,'induced_amplitude.out');
70
71loaddata(hObject,handles); %% charge les donnees
72% OBLIGATOIRE car la fonction loaddata a modifie handles et
73% travailler sur une copie de handles
74handles = guidata(hObject);
75handles.str='';
76
77%% Couleur de depart pour identifiactaion point a point
78handles.couleurs=[1 0 0];
79%% zoom
80handles.type='shift';
81set(handles.edit_shift,'String','0.05');
82handles.shiftaxis = str2double(get(handles.edit_shift,'String'));
83handles.zoomaxis= str2double(get(handles.edit_zoom,'String'));
84
85%%% Variable pour echange avec autres gui
86setappdata(handles.figure1, 'Tab',[]);
87guidata(hObject, handles);
88
89set(handles.edit_color,'BackgroundColor',handles.couleurs);
90%%% Affiche le point de fonctionnement
91print_value(handles,handles.x1(1),handles.x2(1),handles.f1(1),handles.f2(1));
92%%%% dessine les donnees
93plotdata(handles);
94
95%%% axes par defaut
96%set(handles.fmap,'Xlim',[18.1 18.3],'Ylim',[10.20 10.4]);
97
98% UIWAIT makes resongui wait for user response (see UIRESUME)
99% uiwait(handles.figure1);
100
101
102% --- Outputs from this function are returned to the command line.
103function varargout = resongui_OutputFcn(hObject, eventdata, handles)
104% varargout  cell array for returning output args (see VARARGOUT);
105% hObject    handle to figure
106% eventdata  reserved - to be defined in a future version of MATLAB
107% handles    structure with handles and user data (see GUIDATA)
108
109% Get default command line output from handles structure
110varargout{1} = handles.output;
111
112function loaddata(hObject,handles)
113
114fname = fullfile(handles.pathname, handles.dataname)
115try
116    [header data]=hdrload(fname);
117    return %break;
118catch
119    %     error('Error while opening filename %s ',fname)
120    uiwait(errordlg('No input data found'));
121    handles = getdata(handles);
122end
123
124z = data(:,2)*1e3;
125switch handles.maptype
126    case 'fmap'
127        x = data(:,1)*1e3; %% z in mm
128    case 'fmapdp'
129        x = data(:,1)*1e2; %% energy in %
130end
131
132fx=18+abs(data(:,3));
133fz=10+abs(data(:,4));
134
135if size(data,2) == 6;
136    %%% Data for color printing
137    nz = sum(x==x(1));
138    nx = size(x,1)/nz;
139    dfx=data(:,5);
140    dfz=data(:,6);
141   
142    xgrid = reshape(x,nz,nx);
143    zgrid = reshape(z,nz,nx);
144    fxgrid = reshape(fx,nz,nx);
145    fzgrid = reshape(fz,nz,nx);
146    dfxgrid = reshape(dfx,nz,nx);
147    dfzgrid = reshape(dfz,nz,nx);
148    diffusion = 1;
149    diffu = log10(sqrt(dfxgrid.*dfxgrid+dfzgrid.*dfzgrid));
150    %% saturation
151    ind = isinf(diffu);
152    diffu(ind) = NaN;
153    diffumax = -2; diffumin = -10;
154    diffu(diffu< diffumin) = diffumin; % very stable
155    diffu(diffu> diffumax) = diffumax; %chaotic
156    %%  pour affichage couleur
157    handles.diffu = diffu;
158    handles.fxgrid=fxgrid;
159    handles.fzgrid=fzgrid;
160    handles.xgrid=xgrid;
161    handles.zgrid=zgrid;
162end
163%% pour affichage noir et blanc
164indx=(fx~=18.0);
165handles.f1=fx(indx);
166handles.f2=fz(indx);
167handles.x1=x(indx);
168handles.x2=z(indx);   
169
170guidata(hObject,handles);
171% select stable particles
172
173
174% --- Executes on button press in pushbutton_replot.
175function pushbutton_replot_Callback(hObject, eventdata, handles)
176% hObject    handle to pushbutton_replot (see GCBO)
177% eventdata  reserved - to be defined in a future version of MATLAB
178% handles    structure with handles and user data (see GUIDATA)
179%Efface figure et redessine les donnees brutes
180children=get(handles.fmap,'Children');
181%children=findobj(handles.axes,'Children','Type','Line'))
182%child=findobj(handles.axes,'Children','Tag','fmap'))
183%children(children==child)=[];
184%delete(children mais pas child)
185cla(handles.fmap);
186cla(handles.da);
187plotdata(handles);
188getappdata(handles.figure1,'Tab');
189
190function plotdata(handles)
191
192switch handles.color
193    case 'off'
194        axes(handles.fmap); %  hold on;
195        get(handles.fmap,'Children')
196        %         if ~isempty(get(handles.fmap,'Children'))
197        %             delete(findobj(get(handles.fmap,'Children'),'Tag','fspace'));
198        %         end
199        plot(handles.f1,handles.f2,'kd','MarkerSize',0.5,'MarkerFaceColor','k','Tag','fspace');
200        grid on; hold on;
201        %         xlabel('fx');  ylabel('fz');
202        %axis([18.15 18.27 10.265 10.32])
203        axis([min(handles.f1) max(handles.f1) min(handles.f2) max(handles.f2)]) % modification 8 mars 2010 à cause pb échelle (mat)
204        axes(handles.da); hold off;       
205        %%% Choix des axes
206        switch handles.maptype
207            case 'fmap'
208                strx = 'x(mm)';
209                stry = 'z(mm)';
210            case 'fmapdp'
211                strx = 'dp (%)';
212                stry = 'x (mm)';
213        end
214        plot(handles.x1,handles.x2,'kd','MarkerSize',2.0,'MarkerFaceColor','k','Tag','cspace');
215        xlabel(strx); ylabel(stry);
216        grid on;  hold on;
217    case 'on'
218        axes(handles.fmap);  %hold on
219        get(handles.fmap,'Children')
220        switch handles.color
221            case 'off'
222                mesh(handles.fxgrid,handles.fzgrid, handles.diffu,'LineStyle','.','MarkerSize',5.0,'FaceColor','none','Tag','fspace');
223            case 'on'
224                mesh(handles.fxgrid,handles.fzgrid, handles.diffu,'Marker','.','MarkerSize',5.0,'FaceColor','none','LineStyle','none','Tag','fspace');
225        end
226        %         if ~isempty(get(handles.fmap,'Children'))
227        %             delete(findobj(get(handles.fmap,'Children'),'Tag','fspace'));
228        %         end
229        %image(cat(3,handles.diffu,handles.diffu,handles.diffu)/-10,'Tag','fspace');
230        view(2); grid on; hold on
231        xlabel('fx'); ylabel('fz')
232        axes(handles.da);
233        switch handles.color
234            case 'off'
235                mesh(handles.xgrid,handles.zgrid,handles.diffu,'LineStyle','.','MarkerSize',5.0,'FaceColor','none','Tag','cspace');
236            case 'on'
237                mesh(handles.xgrid,handles.zgrid,handles.diffu,'Marker','.','MarkerSize',5.0,'FaceColor','none','LineStyle','none','Tag','fspace');
238        end
239        %image(reshape(handles.xgrid,1,prod(size(handles.xgrid))), ...
240%             reshape(handles.zgrid,1 ,prod(size(handles.zgrid))), ...
241%             cat(3,handles.diffu,handles.diffu,handles.diffu)/-10);
242        view(2); grid on; hold on       
243end
244
245
246%datalabel on
247
248% hc=uicontextmenu;
249% hm=uimenu('parent',hc);
250% set(h,'UIContextMenu',hc);
251% hha=findobj(get(handles.da,'Children'),'Type','axes');
252% set(get(handles.da,'Parent'),'WindowButtonDownFcn', ...
253%     'pt=get(gca,''CurrentPoint'' ); disp(pt); disp(hm); set(hm,''Label'',[num2str(pt(1,1)) '', '' num2str(pt(1,2))])' )
254
255
256%%% Affiche le point de fonctionnement
257print_value(handles,handles.x1(1),handles.x2(1),handles.f1(1),handles.f2(1));
258
259% --- Executes on button press in bouton_resonid.
260function bouton_resonid_Callback(hObject, eventdata, handles)
261% hObject    handle to bouton_resonid (see GCBO)
262% eventdata  reserved - to be defined in a future version of MATLAB
263% handles    structure with handles and user data (see GUIDATA)
264
265% Loop, picking up the points.
266disp('Left mouse button picks points.')
267disp('Right mouse button picks last point.')
268hold on
269button = 1;
270n=0;
271while button == 1
272    [xi,yi,button] = ginput(1);
273    %    plot(xi,yi,'o','Color',handles.couleurs,2.0,'MarkerFaceColor',handles.couleurs)
274    n = n+1;
275    identifier(xi,yi,handles)   
276end
277
278function identifier(xi,yi,handles)
279
280%%% cherche le point le plus proche au sens de la norme 2
281[dp1, i1]=min((handles.f1-xi).^2+(handles.f2-yi).^2);
282[dp2, i2]=min((handles.x1-xi).^2+(handles.x2-yi).^2);
283
284%selectionne la bonne figure sur laquelle on a clique
285if (dp1 < dp2)
286    i3 = i1;
287else
288    i3 =i2;
289end
290
291%%% affiche le point selectionne
292axes(handles.da);
293plot(handles.x1(i3),handles.x2(i3),'o','Color',handles.couleurs);
294axes(handles.fmap);
295plot(handles.f1(i3),handles.f2(i3),'o','Color',handles.couleurs);
296
297print_value(handles,handles.x1(i3),handles.x2(i3),handles.f1(i3),handles.f2(i3));
298
299function print_value(handles,x1,x2,f1,f2)
300%%% Met a jour les valeurs selectionnees
301formatda='% 6.4f';
302formatfmap='% 8.5f';
303
304switch handles.maptype
305    case 'fmap'
306        strx ='x  =';
307        stry ='z  =';
308    case 'fmapdp'
309        strx ='dp =';
310        stry ='x  =';
311end
312string=sprintf([strx,formatda],x1);
313set(handles.text_x,'String',string);
314string=sprintf([stry,formatda],x2);
315set(handles.text_z,'String',string);
316string=sprintf(['fx = ',formatfmap],f1);
317set(handles.text_fx,'String',string);
318string=sprintf(['fz = ',formatfmap],f2);
319set(handles.text_fz,'String',string);
320
321% --- Executes during object creation, after setting all properties.
322function edit_color_CreateFcn(hObject, eventdata, handles)
323% hObject    handle to edit_color (see GCBO)
324% eventdata  reserved - to be defined in a future version of MATLAB
325% handles    empty - handles not created until after all CreateFcns called
326
327% Hint: edit controls usually have a white background on Windows.
328%       See ISPC and COMPUTER.
329if ispc
330    set(hObject,'BackgroundColor','white');
331else
332    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
333end
334
335function edit_color_Callback(hObject, eventdata, handles)
336% hObject    handle to edit_color (see GCBO)
337% eventdata  reserved - to be defined in a future version of MATLAB
338% handles    structure with handles and user data (see GUIDATA)
339
340% Hints: get(hObject,'String') returns contents of edit_color as text
341%        str2double(get(hObject,'String')) returns contents of edit_color as a double
342h = uisetcolor;
343if (size(h,2) ~=1)
344    handles.couleurs = h;
345    guidata(hObject, handles);
346    set(handles.edit_color,'BackgroundColor',handles.couleurs);
347end
348
349
350% --- Executes on button press in increaseV.
351function increaseV_Callback(hObject, eventdata, handles)
352% hObject    handle to increaseV (see GCBO)
353% eventdata  reserved - to be defined in a future version of MATLAB
354% handles    structure with handles and user data (see GUIDATA)
355prop ='Ylim';
356zoomshift(handles,prop,1);
357
358
359% --- Executes on button press in increaseH.
360function increaseH_Callback(hObject, eventdata, handles)
361% hObject    handle to increaseH (see GCBO)
362% eventdata  reserved - to be defined in a future version of MATLAB
363% handles    structure with handles and user data (see GUIDATA)
364prop ='Xlim';
365zoomshift(handles,prop,1);
366
367% --- Executes on button press in decreaseV.
368function decreaseV_Callback(hObject, eventdata, handles)
369% hObject    handle to decreaseV (see GCBO)
370% eventdata  reserved - to be defined in a future version of MATLAB
371% handles    structure with handles and user data (see GUIDATA)
372prop ='Ylim';
373zoomshift(handles,prop,-1);
374
375
376% --- Executes on button press in decreaseH.
377function decreaseH_Callback(hObject, eventdata, handles)
378% hObject    handle to decreaseH (see GCBO)
379% eventdata  reserved - to be defined in a future version of MATLAB
380% handles    structure with handles and user data (see GUIDATA)
381prop ='Xlim';
382zoomshift(handles,prop,-1);
383
384function zoomshift(handles,prop,fac)
385%% Fonction qui gere zoom et deplacement d'axe
386
387scale = get(handles.fmap,prop);
388
389switch handles.type
390    case 'shift'
391        set(handles.fmap,prop,scale+fac*handles.shiftaxis);       
392    case 'zoom'
393        w = scale(2)-scale(1);
394        mid=scale(1) + w/2;
395        if fac ==-1
396            newscale = mid + [-1 1]*0.5*w*handles.zoomaxis;
397        else
398            newscale = mid + [-1 1]*0.5*w/handles.zoomaxis;
399        end
400        set(handles.fmap,prop,newscale);
401end
402axes(handles.fmap);
403setappdata(handles.figure1, 'fen',axis);
404
405% --- Executes during object creation, after setting all properties.
406function edit_zoom_CreateFcn(hObject, eventdata, handles)
407% hObject    handle to edit_zoom (see GCBO)
408% eventdata  reserved - to be defined in a future version of MATLAB
409% handles    empty - handles not created until after all CreateFcns called
410
411% Hint: edit controls usually have a white background on Windows.
412%       See ISPC and COMPUTER.
413if ispc
414    set(hObject,'BackgroundColor','white');
415else
416    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
417end
418
419function edit_zoom_Callback(hObject, eventdata, handles)
420% hObject    handle to edit_zoom (see GCBO)
421% eventdata  reserved - to be defined in a future version of MATLAB
422% handles    structure with handles and user data (see GUIDATA)
423
424% Hints: get(hObject,'String') returns contents of edit_zoom as text
425%        str2double(get(hObject,'String')) returns contents of edit_zoom as a double
426handles.zoomaxis= str2double(get(hObject,'String'));
427guidata(hObject, handles);
428
429
430% --- Executes on button press in radiobutton_zoom.
431function radiobutton_zoom_Callback(hObject, eventdata, handles)
432% hObject    handle to radiobutton_zoom (see GCBO)
433% eventdata  reserved - to be defined in a future version of MATLAB
434% handles    structure with handles and user data (see GUIDATA)
435
436% Hint: get(hObject,'Value') returns toggle state of radiobutton_zoom
437mutual_exclude(handles.radiobutton_shift);
438handles.type='zoom';
439guidata(hObject, handles);
440
441% --- Executes on button press in radiobutton_shift.
442function radiobutton_shift_Callback(hObject, eventdata, handles)
443% hObject    handle to radiobutton_shift (see GCBO)
444% eventdata  reserved - to be defined in a future version of MATLAB
445% handles    structure with handles and user data (see GUIDATA)
446
447% Hint: get(hObject,'Value') returns toggle state of radiobutton_shift
448mutual_exclude(handles.radiobutton_zoom);
449handles.type='shift';
450guidata(hObject, handles);
451
452%%% fonction pour faire des radioboutons
453function mutual_exclude(off)
454set(off,'Value',0);
455
456
457% --- Executes during object creation, after setting all properties.
458function edit_shift_CreateFcn(hObject, eventdata, handles)
459% hObject    handle to edit_shift (see GCBO)
460% eventdata  reserved - to be defined in a future version of MATLAB
461% handles    empty - handles not created until after all CreateFcns called
462
463% Hint: edit controls usually have a white background on Windows.
464%       See ISPC and COMPUTER.
465if ispc
466    set(hObject,'BackgroundColor','white');
467else
468    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
469end
470
471function edit_shift_Callback(hObject, eventdata, handles)
472% hObject    handle to edit_shift (see GCBO)
473% eventdata  reserved - to be defined in a future version of MATLAB
474% handles    structure with handles and user data (see GUIDATA)
475
476% Hints: get(hObject,'String') returns contents of edit_shift as text
477%        str2double(get(hObject,'String')) returns contents of edit_shift as a double
478handles.shiftaxis= str2double(get(hObject,'String'));
479guidata(hObject, handles);
480
481
482% --- Executes on button press in resetfmap.
483function resetfmap_Callback(hObject, eventdata, handles)
484% hObject    handle to pushbutton_replot (see GCBO)
485% eventdata  reserved - to be defined in a future version of MATLAB
486% handles    structure with handles and user data (see GUIDATA)
487set(handles.fmap,'XLimMode','auto','YLimMode','auto');
488pause(0.1);
489set(handles.fmap,'XLimMode','manual','YLimMode','manual');
490
491
492% --------------------------------------------------------------------
493function souris_Callback(hObject, eventdata, handles)
494% hObject    handle to souris (see GCBO)
495% eventdata  reserved - to be defined in a future version of MATLAB
496% handles    structure with handles and user data (see GUIDATA)
497pt=get(gca,'CurrentPoint');
498tab = getappdata(handles.figure1,'Tab');
499handles.str = plusprochereson([pt(1,1), pt(1,2)],tab);
500set(handles.resonance,'Label', handles.str);
501guidata(hObject,handles); %% mise a jour donnees
502
503% --------------------------------------------------------------------
504function Untitled_3_Callback(hObject, eventdata, handles)
505% hObject    handle to Untitled_3 (see GCBO)
506% eventdata  reserved - to be defined in a future version of MATLAB
507% handles    structure with handles and user data (see GUIDATA)
508
509
510% --- Executes on button press in pushbutton_reson.
511function pushbutton_reson_Callback(hObject, eventdata, handles)
512% hObject    handle to pushbutton_reson (see GCBO)
513% eventdata  reserved - to be defined in a future version of MATLAB
514% handles    structure with handles and user data (see GUIDATA)
515setappdata(handles.figure1, 'where2plot',handles.fmap);
516axes(handles.fmap);
517setappdata(handles.figure1, 'fen',axis);
518% if ~isfield(handles,'showreson')
519handles.showreson=showresongui(handles);
520guidata(hObject,handles);
521% end
522% showresongui('where2plot',handles.fmap,'fen',axis);
523
524
525% --------------------------------------------------------------------
526function resonance_Callback(hObject, eventdata, handles)
527% hObject    handle to resonance (see GCBO)
528% eventdata  reserved - to be defined in a future version of MATLAB
529% handles    structure with handles and user data (see GUIDATA)
530disp(handles.str)
531
532
533% --------------------------------------------------------------------
534function Untitled_1_Callback(hObject, eventdata, handles)
535% hObject    handle to Untitled_1 (see GCBO)
536% eventdata  reserved - to be defined in a future version of MATLAB
537% handles    structure with handles and user data (see GUIDATA)
538
539
540% --------------------------------------------------------------------
541function LoadDataFile_Callback(hObject, eventdata, handles)
542% hObject    handle to LoadDataFile (see GCBO)
543% eventdata  reserved - to be defined in a future version of MATLAB
544% handles    structure with handles and user data (see GUIDATA)
545
546handles = getdata(handles);
547guidata(hObject,handles);
548loaddata(hObject, handles);
549handles=guidata(hObject); % mis a jour des modification dans loaddata
550
551
552% --------------------------------------------------------------------
553function handles = getdata(handles);
554% fonction pour ouvrir un fichier de donnees
555% utilise l'interface graphique
556% ne rend la main que si un fichier a ete correctement choisi!
557
558[filename, pathname] = uigetfile('*.out', 'Pick an data file');
559
560if isequal(filename,0) | isequal(pathname,0)
561    disp('User pressed cancel')
562else
563    disp(['User selected ', fullfile(pathname, filename)])
564    handles.dataname = filename;
565    handles.pathname = pathname;
566end
567
568% --------------------------------------------------------------------
569function LoadDataInduced_Callback(hObject, eventdata, handles)
570% hObject    handle to LoadDataInduced (see GCBO)
571% eventdata  reserved - to be defined in a future version of MATLAB
572% handles    structure with handles and user data (see GUIDATA)
573
574
575% --- Executes on button press in toggle_IA.
576function toggle_IA_Callback(hObject, eventdata, handles)
577% hObject    handle to toggle_IA (see GCBO)
578% eventdata  reserved - to be defined in a future version of MATLAB
579% handles    structure with handles and user data (see GUIDATA)
580
581% Hint: get(hObject,'Value') returns toggle state of toggle_IA
582val = get(hObject,'Value')
583switch val
584    case 1
585        fname = handles.data_inducedamplitude;
586        if exist(fname)
587            axes(handles.da);
588            [header A] = hdrload(fname);
589            plot(A(:,1),A(:,2),'k-.','Tag','IA');
590        else
591            warning('Filname %s not found\n',fname);
592            set(handles.toggle_IA,'Value',0);
593        end
594    otherwise
595        delete(findobj(get(handles.da,'Children'),'Tag','IA'))       
596end
597
598% --- Executes on button press in toogle_color.
599function toogle_color_Callback(hObject, eventdata, handles)
600% hObject    handle to toogle_color (see GCBO)
601% eventdata  reserved - to be defined in a future version of MATLAB
602% handles    structure with handles and user data (see GUIDATA)
603
604% Hint: get(hObject,'Value') returns toggle state of toogle_color
605val = get(hObject,'Value');
606switch val
607    case 0
608        handles.color = 'off';
609    case 1
610        if isfield(handles,'diffu')
611            handles.color = 'on';
612        else
613            set(hObject,'Value',0);
614        end       
615end
616guidata(hObject,handles);
617
618
619% --- Executes during object creation, after setting all properties.
620function popupmenu_typemap_CreateFcn(hObject, eventdata, handles)
621% hObject    handle to popupmenu_typemap (see GCBO)
622% eventdata  reserved - to be defined in a future version of MATLAB
623% handles    empty - handles not created until after all CreateFcns called
624
625% Hint: popupmenu controls usually have a white background on Windows.
626%       See ISPC and COMPUTER.
627if ispc
628    set(hObject,'BackgroundColor','white');
629else
630    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
631end
632
633
634% --- Executes on selection change in popupmenu_typemap.
635function popupmenu_typemap_Callback(hObject, eventdata, handles)
636% hObject    handle to popupmenu_typemap (see GCBO)
637% eventdata  reserved - to be defined in a future version of MATLAB
638% handles    structure with handles and user data (see GUIDATA)
639
640% Hints: contents = get(hObject,'String') returns popupmenu_typemap contents as cell array
641%        contents{get(hObject,'Value')} returns selected item from popupmenu_typemap
642
643contents = get(hObject,'String');
644val = contents{get(hObject,'Value')};
645switch val
646    case 'fmap'
647        handles.maptype = 'fmap';
648        xlabel('x (mm)'); ylabel('z (mm)');
649    case 'fmapdp'
650        handles.maptype = 'fmapdp';
651        xlabel('dp (%)'); ylabel('x (mm)');
652end
653guidata(hObject,handles);
654
655
656% --------------------------------------------------------------------
657function menu_popup_Callback(hObject, eventdata, handles)
658% hObject    handle to menu_popup (see GCBO)
659% eventdata  reserved - to be defined in a future version of MATLAB
660% handles    structure with handles and user data (see GUIDATA)
661
662
663% --------------------------------------------------------------------
664function menu_popup1_Callback(hObject, eventdata, handles)
665% hObject    handle to menu_popup1 (see GCBO)
666% eventdata  reserved - to be defined in a future version of MATLAB
667% handles    structure with handles and user data (see GUIDATA)
668a = figure;
669b = copyobj(handles.fmap, a);
670% set(b, 'Position', [0.1300    0.5811    0.7750    0.3439]);
671set(b, 'Position', get(0,'FactoryAxesPosition'));
672% set(b, 'ButtonDownFcn','');
673
674% --------------------------------------------------------------------
675function menu_popup2_Callback(hObject, eventdata, handles)
676% hObject    handle to menu_popup2 (see GCBO)
677% eventdata  reserved - to be defined in a future version of MATLAB
678% handles    structure with handles and user data (see GUIDATA)
679a = figure;
680b = copyobj(handles.da, a);
681% set(b, 'Position', [0.1300    0.5811    0.7750    0.3439]);
682set(b, 'Position', get(0,'FactoryAxesPosition'));
683set(b, 'ButtonDownFcn','');
684
685% --------------------------------------------------------------------
686function menu_popup12_Callback(hObject, eventdata, handles)
687% hObject    handle to menu_popup12 (see GCBO)
688% eventdata  reserved - to be defined in a future version of MATLAB
689% handles    structure with handles and user data (see GUIDATA)
690
691a = figure;
692b = copyobj(handles.fmap, a);
693set(b, 'Position', [0.1300    0.5811    0.7750    0.3439]);
694set(b, 'ButtonDownFcn','');
695% if strcmpi(get(handles.('AddPlot1_Lattice'),'Checked'),'On')
696%     b = copyobj(handles.('Graph3'), a);
697%     set(b, 'Position', [0.1300    0.5811    0.7750    0.3439]);
698% end
699
700b = copyobj(handles.da, a);
701set(b, 'Position', [0.1300    0.1100    0.7750    0.3439]);
702set(b, 'ButtonDownFcn','');
703% if strcmpi(get(handles.('AddPlot2_Lattice'),'Checked'),'On')
704%     b = copyobj(handles.('Graph4'), a);
705%     set(b, 'Position', [0.1300    0.1100    0.7750    0.3439]);
706% end
707xlabel('Position [meters]');
708
709Data = getappdata(gcbf, 'RawY');
710if isfield(Data, 'TimeStamp')
711    addlabel(1,0,datestr(Data.TimeStamp,21));
712end
713orient tall
Note: See TracBrowser for help on using the repository browser.