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

📄 chselect.m

📁 EOG Correction program is used to work out the amount of ocular potential recorded by the electroenc
💻 M
字号:
function varargout = chselect(varargin)
% Last Modified by GUIDE v2.5 26-Oct-2007 00:00:28
% CHSELECT: select the channel for VE, HE, and RE
%      CHSELECT, by itself, creates a new CHSELECT or raises the existing
%      singleton*.
%
%      H = CHSELECT returns the handle to a new CHSELECT or the handle to
%      the existing singleton*.
%
%      CHSELECT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CHSELECT.M with the given input arguments.
%
%      CHSELECT('Property','Value',...) creates a new CHSELECT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before chselect_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to chselect_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
%   See also: GUIDE, GUIDATA, GUIHANDLES
%
%   Programmed and Copyright by Tony Tanoyo: tony.tanoyo@gmail.com
%   $Revision: 01 $  $Date: 24/10/2007$
%
%   Files Contribution:
%   Yair Altman for the statusbar function, May 2007.
%   Daniel Claxton for the workbar function, March 2005.
%   Xiaoning (David) Yang for the keep function, 1998. 

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @chselect_OpeningFcn, ...
                   'gui_OutputFcn',  @chselect_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(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 chselect is made visible.
function chselect_OpeningFcn(hObject, eventdata, handles, varargin)

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

% Update handles structure
guidata(hObject, handles);

% Set hMainGui to the root
hMainGui = getappdata(0, 'hMainGui'); 

% 1. Assign the channel listbox to the ch_labels
ch_label=getappdata(hMainGui,'ch_label');
set(handles.ch_listbox,'string',ch_label);

% 2. Assign the operator listbox to the ops
ops={'+','-','*','/','(',')'};
set(handles.op_listbox,'string',ops);

% 3. Assign the numeric listbox to the num
num={'1','2','3','4','5','6','7','8','9','10'};
set(handles.num_listbox,'string',num);

% 4. Assign the VE, HE, and RE edit txts to the previous main
VE=getappdata(hMainGui,'VE');
HE=getappdata(hMainGui,'HE');
RE=getappdata(hMainGui,'RE');
set(handles.edit_VE,'String',VE);
set(handles.edit_HE,'String',HE);
set(handles.edit_RE,'String',RE);

% 5. Enable the "edit_VE" handles as default and disable edit_HE and edit_RE
set(handles.VE_radiobutton,'Value',1);
set(handles.HE_radiobutton,'Value',0);
set(handles.RE_radiobutton,'Value',0);
set(handles.edit_VE,'Enable','On');
set(handles.edit_HE,'Enable','Off');
set(handles.edit_RE,'Enable','Off');

% --- Outputs from this function are returned to the command line.
function varargout = chselect_OutputFcn(hObject, eventdata, handles) 
% Get default command line output from handles structure
varargout{1} = handles.output;

% -----------------------------
% List boxes:
% -----------------------------
% --- Executes on selection change in ch_listbox.
function ch_listbox_Callback(hObject, eventdata, handles)
% Hints: contents = get(hObject,'String') returns ch_listbox contents as cell array
%        contents{get(hObject,'Value')} returns selected item from ch_listbox

% Get the str from the edit txts
if get(handles.VE_radiobutton,'Value')==1
    str=get(handles.edit_VE,'String');
elseif get(handles.HE_radiobutton,'Value')==1
    str=get(handles.edit_HE,'String');
elseif get(handles.RE_radiobutton,'Value')==1
    str=get(handles.edit_RE,'String');
end

hMainGui = getappdata(0, 'hMainGui'); 
chlist=get(hObject,'String');
chval=get(hObject,'Value');
chstr=chlist{chval};
str=[str chstr];

if get(handles.VE_radiobutton,'Value')==1
    set(handles.edit_VE,'String',str);
elseif get(handles.HE_radiobutton,'Value')==1
    set(handles.edit_HE,'String',str);
elseif get(handles.RE_radiobutton,'Value')==1
    set(handles.edit_RE,'String',str);
end


% --- Executes during object creation, after setting all properties.
function ch_listbox_CreateFcn(hObject, eventdata, handles)
% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in op_listbox.
function op_listbox_Callback(hObject, eventdata, handles)
% Hints: contents = get(hObject,'String') returns op_listbox contents as cell array
%        contents{get(hObject,'Value')} returns selected item from op_listbox

% Get the str from the edit txts
if get(handles.VE_radiobutton,'Value')==1
    str=get(handles.edit_VE,'String');
elseif get(handles.HE_radiobutton,'Value')==1
    str=get(handles.edit_HE,'String');
elseif get(handles.RE_radiobutton,'Value')==1
    str=get(handles.edit_RE,'String');
end

hMainGui = getappdata(0, 'hMainGui'); 
oplist=get(hObject,'String');
opval=get(hObject,'Value');
opstr=oplist{opval};
str=[str opstr];

if get(handles.VE_radiobutton,'Value')==1
    set(handles.edit_VE,'String',str);
elseif get(handles.HE_radiobutton,'Value')==1
    set(handles.edit_HE,'String',str);
elseif get(handles.RE_radiobutton,'Value')==1
    set(handles.edit_RE,'String',str);
end

% --- Executes during object creation, after setting all properties.
function op_listbox_CreateFcn(hObject, eventdata, handles)
% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in num_listbox.
function num_listbox_Callback(hObject, eventdata, handles)
% Hints: contents = get(hObject,'String') returns num_listbox contents as cell array
%        contents{get(hObject,'Value')} returns selected item from num_listbox

% Get the str from the edit txts
if get(handles.VE_radiobutton,'Value')==1
    str=get(handles.edit_VE,'String');
elseif get(handles.HE_radiobutton,'Value')==1
    str=get(handles.edit_HE,'String');
elseif get(handles.RE_radiobutton,'Value')==1
    str=get(handles.edit_RE,'String');
end

hMainGui = getappdata(0, 'hMainGui'); 
numlist=get(hObject,'String');
numval=get(hObject,'Value');
numstr=numlist{numval};
str=[str numstr];

if get(handles.VE_radiobutton,'Value')==1
    set(handles.edit_VE,'String',str);
elseif get(handles.HE_radiobutton,'Value')==1
    set(handles.edit_HE,'String',str);
elseif get(handles.RE_radiobutton,'Value')==1
    set(handles.edit_RE,'String',str);
end

% --- Executes during object creation, after setting all properties.
function num_listbox_CreateFcn(hObject, eventdata, handles)
% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% -----------------------------
% Radio buttons:
% -----------------------------
% --- Executes on button press in VE_radiobutton.
function VE_radiobutton_Callback(hObject, eventdata, handles)
% Hint: get(hObject,'Value') returns toggle state of VE_radiobutton
% default: 1.0 (on)

set(handles.edit_VE,'Enable','On');
set(handles.edit_HE,'Enable','Off');
set(handles.edit_RE,'Enable','Off');

set(handles.VE_radiobutton,'Value',1);

function HE_radiobutton_Callback(hObject, eventdata, handles)
set(handles.edit_VE,'Enable','Off');
set(handles.edit_HE,'Enable','On');
set(handles.edit_RE,'Enable','Off');

set(handles.HE_radiobutton,'Value',1);

function RE_radiobutton_Callback(hObject, eventdata, handles)
set(handles.edit_VE,'Enable','Off');
set(handles.edit_HE,'Enable','Off');
set(handles.edit_RE,'Enable','On');

set(handles.RE_radiobutton,'Value',1);

% -----------------------------
% Edit texts:
% -----------------------------
function edit_VE_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of edit_VE as text
%        str2double(get(hObject,'String')) returns contents of edit_VE as a double

hMainGui = getappdata(0, 'hMainGui'); 
VE=get(hObject,'String');
run_id=1;
setappdata(hMainGui,'run_id',run_id);
setappdata(hMainGui,'VE',VE);

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

function edit_HE_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of edit_HE as text
%        str2double(get(hObject,'String')) returns contents of edit_HE as a double

hMainGui = getappdata(0, 'hMainGui');
HE=get(hObject,'String');
setappdata(hMainGui,'HE',HE);

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

function edit_RE_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of edit_RE as text
%        str2double(get(hObject,'String')) returns contents of edit_RE as a double

hMainGui = getappdata(0, 'hMainGui');
RE=get(hObject,'String');
setappdata(hMainGui,'RE',RE);

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

% -----------------------------
% Push buttons:
% -----------------------------
% --- Executes on button press in deletepushbutton.
function deletepushbutton_Callback(hObject, eventdata, handles)

% Get the str from the edit txts
if get(handles.VE_radiobutton,'Value')==1
    str=get(handles.edit_VE,'String');
elseif get(handles.HE_radiobutton,'Value')==1
    str=get(handles.edit_HE,'String');
elseif get(handles.RE_radiobutton,'Value')==1
    str=get(handles.edit_RE,'String');
end

str=str(1:end-1);

if get(handles.VE_radiobutton,'Value')==1
    set(handles.edit_VE,'String',str);
elseif get(handles.HE_radiobutton,'Value')==1
    set(handles.edit_HE,'String',str);
elseif get(handles.RE_radiobutton,'Value')==1
    set(handles.edit_RE,'String',str);
end

% --- Executes on button press in clearpushbutton.
function clearpushbutton_Callback(hObject, eventdata, handles)
% clear the edit txts for VE, or HE, or RE (whichever one is selected)
% Get the str from the edit txts

if get(handles.VE_radiobutton,'Value')==1
    set(handles.edit_VE,'String','');
elseif get(handles.HE_radiobutton,'Value')==1
    set(handles.edit_HE,'String','');
elseif get(handles.RE_radiobutton,'Value')==1
    set(handles.edit_RE,'String','');
end

% --- Executes on button press in donepushbutton.
function donepushbutton_Callback(hObject, eventdata, handles)

hMainGui = getappdata(0, 'hMainGui');

% Get the edit txts handles from the main GUI
edit_VE_main=getappdata(hMainGui,'edit_VE_main');
edit_HE_main=getappdata(hMainGui,'edit_HE_main');
edit_RE_main=getappdata(hMainGui,'edit_RE_main');

% Get the current str of edit txts from the chselect GUI
VE=get(handles.edit_VE,'String');
HE=get(handles.edit_HE,'String');
RE=get(handles.edit_RE,'String');

% % Set the values of VE, HE, and RE str to hMainGui
setappdata(hMainGui,'VE',VE);
setappdata(hMainGui,'HE',HE);
setappdata(hMainGui,'RE',RE);

% Set the string of the edit txts main GUI
set(edit_VE_main,'String',VE);
set(edit_HE_main,'String',HE);
set(edit_RE_main,'String',RE);

closereq;

% -------------------
% Menu Selections
% -------------------
function File_Callback(hObject, eventdata, handles)

function Close_Callback(hObject, eventdata, handles)

closereq;

function Help1_Callback(hObject, eventdata, handles)

function Help2_Callback(hObject, eventdata, handles)

winopen([pwd '\Help.pdf']); 

function About_Callback(hObject, eventdata, handles)

winopen([pwd '\About.pdf']);  % to open pdf files

⌨️ 快捷键说明

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