Home > machine > Soleil > common > synchro > softsynchro.m

softsynchro

PURPOSE ^

SOFTSYNCHRO M-file for softsynchro.fig

SYNOPSIS ^

function varargout = softsynchro(varargin)

DESCRIPTION ^

 SOFTSYNCHRO M-file for softsynchro.fig
      
% handles.periode = periode en seconde
% fonction_alex : fonction trigger (à remplir)

 See also:

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = softsynchro(varargin)
0002 % SOFTSYNCHRO M-file for softsynchro.fig
0003 %
0004 %% handles.periode = periode en seconde
0005 %% fonction_alex : fonction trigger (à remplir)
0006 %
0007 % See also:
0008 
0009 % Edit the above text to modify the response to help softsynchro
0010 
0011 % Last Modified by GUIDE v2.5 20-Apr-2006 15:06:22
0012 
0013 % Begin initialization code - DO NOT EDIT
0014 gui_Singleton = 1;
0015 gui_State = struct('gui_Name',       mfilename, ...
0016                    'gui_Singleton',  gui_Singleton, ...
0017                    'gui_OpeningFcn', @softsynchro_OpeningFcn, ...
0018                    'gui_OutputFcn',  @softsynchro_OutputFcn, ...
0019                    'gui_LayoutFcn',  [] , ...
0020                    'gui_Callback',   []);
0021 if nargin && ischar(varargin{1})
0022     gui_State.gui_Callback = str2func(varargin{1});
0023 end
0024 
0025 if nargout
0026     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0027 else
0028     gui_mainfcn(gui_State, varargin{:});
0029 end
0030 % End initialization code - DO NOT EDIT
0031 
0032 
0033 % --- Executes just before softsynchro is made visible.
0034 function softsynchro_OpeningFcn(hObject, eventdata, handles, varargin)
0035 % This function has no output args, see OutputFcn.
0036 % hObject    handle to figure
0037 % eventdata  reserved - to be defined in a future version of MATLAB
0038 % handles    structure with handles and user data (see GUIDATA)
0039 % varargin   command line arguments to softsynchro (see VARARGIN)
0040 
0041 % Choose default command line output for softsynchro
0042 handles.output = hObject;
0043 
0044 % periode du trigger par defaut = 4/3
0045 handles.periode = 1.333;
0046 set(handles.edit1,'String',num2str(handles.periode));
0047 
0048 % Creates timer Infinite loop
0049 timer1=timer('StartDelay',1,...
0050     'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
0051 timer1.TimerFcn = {@fonction_alex, hObject,eventdata, handles};
0052 setappdata(handles.figure1,'Timer',timer1);
0053 
0054 % button group sur on/off timer du trigger
0055 h = uibuttongroup('visible','off','Position',[0.1 0.1 0.8 0.45],...
0056     'Title','Trigger','TitlePosition','centertop',...
0057     'BackgroundColor',[0.696 1.0 0.924]);
0058 u1 = uicontrol('Style','Radio','String','OFF','Tag','radiobutton1',...
0059     'pos',[80 25 90 25],'parent',h,'HandleVisibility','off',...
0060     'BackgroundColor',[0.696 1.0 0.924]);
0061 u2 = uicontrol('Style','Radio','String','ON','Tag','radiobutton2',...
0062     'pos',[80 65 90 25],'parent',h,'HandleVisibility','off',...
0063     'BackgroundColor',[0.696 1.0 0.924]);
0064 set(h,'SelectionChangeFcn',...
0065     {@uibuttongroup_SelectionChangeFcn,handles});
0066 
0067 set(h,'SelectedObject',u1); 
0068 set(h,'Visible','on');
0069 
0070 %% Set closing gui function
0071 set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer1,handles.figure1});
0072 
0073 % Update handles structure
0074 guidata(hObject, handles);
0075 
0076 % UIWAIT makes softsynchro wait for user response (see UIRESUME)
0077 % uiwait(handles.figure1);
0078 
0079 
0080 % --- Outputs from this function are returned to the command line.
0081 function varargout = softsynchro_OutputFcn(hObject, eventdata, handles) 
0082 % varargout  cell array for returning output args (see VARARGOUT);
0083 % hObject    handle to figure
0084 % eventdata  reserved - to be defined in a future version of MATLAB
0085 % handles    structure with handles and user data (see GUIDATA)
0086 
0087 % Get default command line output from handles structure
0088 varargout{1} = handles.output;
0089 
0090 
0091 
0092 function edit1_Callback(hObject, eventdata, handles)
0093 % hObject    handle to edit1 (see GCBO)
0094 % eventdata  reserved - to be defined in a future version of MATLAB
0095 % handles    structure with handles and user data (see GUIDATA)
0096 
0097 % Hints: get(hObject,'String') returns contents of edit1 as text
0098 %        str2double(get(hObject,'String')) returns contents of edit1 as a double
0099 
0100 handles.periode = str2double(get(hObject,'String'));
0101 
0102 % change timer Infinite loop
0103 timer1=timer('StartDelay',1,...
0104     'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
0105 timer1.TimerFcn = {@fonction_alex, hObject,eventdata, handles};
0106 setappdata(handles.figure1,'Timer',timer1);
0107 
0108 % Update handles structure
0109 guidata(hObject, handles);
0110 
0111 % --- Executes during object creation, after setting all properties.
0112 function edit1_CreateFcn(hObject, eventdata, handles)
0113 % hObject    handle to edit1 (see GCBO)
0114 % eventdata  reserved - to be defined in a future version of MATLAB
0115 % handles    empty - handles not created until after all CreateFcns called
0116 
0117 % Hint: edit controls usually have a white background on Windows.
0118 %       See ISPC and COMPUTER.
0119 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0120     set(hObject,'BackgroundColor','white');
0121 end
0122 
0123 function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
0124 % hObject    handle to uipanel1 (see GCBO)
0125 % eventdata  reserved - to be defined in a future version of MATLAB
0126 % handles    structure with handles and user data (see GUIDATA)
0127 
0128 timer1 = getappdata(handles.figure1,'Timer');
0129 switch get(get(hObject,'SelectedObject'),'Tag')  % Get Tag of selected object
0130     case 'radiobutton1'
0131         % démarrage du trigger
0132         stop(timer1);
0133        
0134     case 'radiobutton2'
0135         % stop du trigger
0136         start(timer1);
0137         
0138 end
0139 
0140 function fonction_alex(arg1,arg2,hObject,eventdata,handles)
0141 % hObject    handle to uipanel1 (see GCBO)
0142 % eventdata  reserved - to be defined in a future version of MATLAB
0143 % handles    structure with handles and user data (see GUIDATA)
0144 
0145 %%  FONCTION ALEX
0146 disp('ça marche !!')
0147 tango_command_inout('ANS/SY/CENTRAL','FireSoftEvent')
0148 
0149 
0150 
0151 
0152 
0153 
0154 
0155 %% What to do before closing the application
0156 function Closinggui(obj, event, handles, figure1)
0157 
0158 % Get default command line output from handles structure
0159 answer = questdlg('Fermer softsynchro ?',...
0160     'Exit softsynchro',...
0161     'Yes','No','Yes');
0162 
0163 switch answer
0164     case 'Yes'           
0165         delete(handles); %Delete Timer
0166         delete(figure1); %Close gui
0167     otherwise
0168         disp('Closing aborted')
0169 end

Generated on Mon 21-May-2007 15:35:27 by m2html © 2003