⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configurationgui.m

📁 A graphical user interface designed to control a confocal microscope.
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = ConfigurationGUI(varargin)
% CONFIGURATIONGUI M-file for ConfigurationGUI.fig
% Open a window to control and set up the amplifiers.
%


% Edit the above text to modify the response to help ConfigurationGUI

% Last Modified by GUIDE v2.5 12-May-2004 11:58:35

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ConfigurationGUI_OpeningFcn, ...
                   'gui_OutputFcn',  @ConfigurationGUI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes just before ConfigurationGUI is made visible.
function ConfigurationGUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to ConfigurationGUI (see VARARGIN)

% Choose default command line output for ConfigurationGUI
handles.output = hObject;

% Read intput variable: 
% Handle of the Main window
handles.Main=varargin{1};
% Load parameters from the Main window
Main_handles=guidata(handles.Main);
% Update local variables
handles.UseF=1/1.328125;   % approx .75   % Use Factor or porcentage of used data

if Main_handles.NumbPixels==640
    set(handles.NumbPixels,'Value',2)
    handles.ValNumbPixels=640;
    set(handles.NumbLines,'String',cellstr([' 480';' 100';'  50';'  20']))
else
    set(handles.NumbPixels,'Value',1)
    handles.ValNumbPixels=320;
    set(handles.NumbLines,'String',cellstr([' 240';' 100';'  50';'  20']))
end    
set(handles.NumbLines,'Value',1+(Main_handles.NumbLines==100)*1+(Main_handles.NumbLines==50)*2+(Main_handles.NumbLines==20)*3)
handles.ValNumbLines=Main_handles.NumbLines;
set(handles.BinF,'Value',1+(Main_handles.BinF==2)*1+(Main_handles.BinF==4)*2)
handles.ValBinF=Main_handles.BinF;
set(handles.RaisT,'Value',1+(Main_handles.RaisT==3.4e-3)*1)
handles.ValRaisT=Main_handles.RaisT;
set(handles.MaxValue,'Value',1+(Main_handles.MaxValue==200)*1+(Main_handles.MaxValue==400)*2+(Main_handles.MaxValue==800)*3)
handles.ValMaxValue=Main_handles.MaxValue;
set(handles.KalmanMem,'String',num2str(Main_handles.KalmanMem))
handles.ValKalmanMem=Main_handles.KalmanMem;
set(handles.NumbSequ,'String',num2str(Main_handles.NumbSequ))
handles.ValNumbSequ=Main_handles.NumbSequ;
set(handles.Step,'String',sprintf('%.1f',Main_handles.Step))
handles.ValStep=Main_handles.Step;
handles.ValInpFs=0;
% Locate the window
set(hObject,'Position',[Main_handles.LocConGUI, 285, 416]);
% Update handles structure
guidata(hObject, handles);
% Update Input Frequency
InpFs_Callback(handles.InpFs, eventdata, handles);

% UIWAIT makes ConfigurationGUI wait for user response (see UIRESUME)
% uiwait(handles.Config);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Outputs from this function are returned to the command line.
function varargout = ConfigurationGUI_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes when user attempts to close Config.
function Config_CloseRequestFcn(hObject, eventdata, handles)
% hObject    handle to Config (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Update parameters
Update_Callback(handles.Update,'',handles);
% Hint: delete(hObject) closes the figure
delete(hObject);

% Hint: delete(hObject) closes the figure
% uiresume(handles.Config);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function NumbPixels_CreateFcn(hObject, eventdata, handles)
% hObject    handle to NumbPixels (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on selection change in NumbPixels.
function NumbPixels_Callback(hObject, eventdata, handles)
% hObject    handle to NumbPixels (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns NumbPixels contents as cell array
%        contents{get(hObject,'Value')} returns selected item from NumbPixels
Cont = get(hObject,'String');
Val = get(hObject,'Value');
handles.ValNumbPixels = str2num(Cont{Val});
if Val==2
    set(handles.NumbLines,'String',cellstr([' 480';' 100';'  50';'  20']),'Value',1)
    handles.ValNumbLines = 480;
else
    set(handles.NumbLines,'String',cellstr([' 240';' 100';'  50';'  20']),'Value',1)
    handles.ValNumbLines = 240;
end    
set(handles.NumbLines,'Value',1);
% Update handles structure
guidata(hObject, handles);
% Update Input Frequency
InpFs_Callback(handles.InpFs, eventdata, handles);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function InpFs_CreateFcn(hObject, eventdata, handles)
% hObject    handle to InpFs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function InpFs_Callback(hObject, eventdata, handles)
% hObject    handle to InpFs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of InpFs as text
%        str2double(get(hObject,'String')) returns contents of InpFs as a double
ValInpFs=round((handles.ValNumbPixels*handles.ValBinF)/(1000*handles.UseF*handles.ValRaisT));
set(handles.InpFs,'String',[num2str(ValInpFs) 'KHz'])
handles.ValInpFs=ValInpFs;
% Update handles structure
guidata(hObject, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function NumbLines_CreateFcn(hObject, eventdata, handles)
% hObject    handle to NumbLines (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on selection change in NumbLines.
function NumbLines_Callback(hObject, eventdata, handles)
% hObject    handle to NumbLines (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns NumbLines contents as cell array
%        contents{get(hObject,'Value')} returns selected item from NumbLines
Cont = get(hObject,'String');
Val = get(hObject,'Value');
handles.ValNumbLines = str2num(Cont{Val});
% Update handles structure
guidata(hObject, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function BinF_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BinF (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on selection change in BinF.
function BinF_Callback(hObject, eventdata, handles)
% hObject    handle to BinF (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns BinF contents as cell array
%        contents{get(hObject,'Value')} returns selected item from BinF
Cont = get(hObject,'String');
Val = get(hObject,'Value');
handles.ValBinF = str2num(Cont{Val});
% Update handles structure

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -