📄 erp_select_chan.m
字号:
function [new_chan_order_str, new_system] = erp_select_chan(varargin)
%
% usage: [new_chan_order_str, new_system = ...
% erp_select_chan(old_chan_order_str, old_system, title, view_system)
%
if nargin == 0 | ischar(varargin{1}) % create figure
old_chan_order_str = '';
old_system.class = 1;
old_system.type = 1;
tit_nam = 'Edit';
view_system = 'on';
new_chan_order_str = '';
if (nargin >= 1), old_chan_order_str = varargin{1}; end;
if (nargin >= 2), old_system = varargin{2}; end;
if (nargin >= 3), tit_nam = varargin{3}; end;
if (nargin >= 4)
if varargin{4}
view_system = 'on';
else
view_system = 'off';
end
end;
init(old_chan_order_str, old_system, tit_nam, view_system);
uiwait; % wait for user finish
new_chan_order_str = getappdata(gcf,'new_chan_order_str');
new_system = getappdata(gcf,'new_system');
close(gcf);
return;
end;
% clear the message line,
%
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
action = upper(varargin{1}{1});
if strcmp(action,'CREATE_EDIT_FILTER'),
filter_pattern = getappdata(gcf,'FilterPattern');
dir_name = pwd;
if isempty(dir_name),
dir_name = filesep;
end;
set(gcbo,'String',fullfile(dir_name,filter_pattern));
elseif strcmp(action,'EDIT_FILTER'),
EditFilter;
elseif strcmp(action,'RESIZE_FIGURE'),
SetObjectPositions;
elseif strcmp(action,'ADD_SESSION_PROFILE'),
AddSessionProfile;
elseif strcmp(action,'REMOVE_SESSION_PROFILE'),
RemoveSessionProfile;
elseif strcmp(action,'MOVE_UP_PROFILE'),
MoveUpSessionProfile;
elseif strcmp(action,'MOVE_DOWN_PROFILE'),
MoveDownSessionProfile;
elseif strcmp(action,'TOGGLE_FULL_PATH'),
SwitchFullPath;
elseif strcmp(action,'DELETE_FIG')
delete_fig;
elseif strcmp(action,'LOAD_TXT')
load_txt;
elseif strcmp(action,'SAVE_TXT')
save_txt;
elseif strcmp(action,'CLASS_BUTTON_PRESSED'),
select_class;
elseif strcmp(action,'TYPE_BUTTON_PRESSED'),
select_type;
elseif strcmp(action,'DONE_BUTTON_PRESSED'),
SelectedChannelList = get(findobj(gcf,'Tag','SelectedChannelList'),'Userdata');
setappdata(gcf,'new_chan_order_str', num2str(SelectedChannelList));
setappdata(gcf,'new_system',getappdata(gcf,'new_system'));
uiresume;
elseif strcmp(action,'CANCEL_BUTTON_PRESSED'),
setappdata(gcf,'new_chan_order_str',getappdata(gcf,'old_chan_order_str'));
setappdata(gcf,'new_system',getappdata(gcf,'old_system'));
uiresume;
end;
return;
% --------------------------------------------------------------------
function init(old_chan_order_str, old_system, tit_nam, view_system)
switch old_system.class
case 1
type_str = 'BESAThetaPhi|EGI128|EGI256';
switch old_system.type
case 1
load('erp_loc_besa148');
case 2
load('erp_loc_egi128');
case 3
load('erp_loc_egi256');
end
case 2
type_str = 'CTF-150';
switch old_system.type
case 1
load('erp_loc_ctf150');
end
end
chan_num = size(chan_loc, 1);
save_setting_status = 'on';
erp_select_chan_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(erp_select_chan_pos) & strcmp(save_setting_status,'on')
pos = erp_select_chan_pos;
else
w = 0.7;
h = 0.7;
x = (1-w)/2;
y = (1-h)/2;
pos = [x y w h];
end
h0 = figure('Color',[0.8 0.8 0.8], ...
'Units','normal', ...
'Name',tit_nam, ...
'NumberTitle','off', ...
'MenuBar','none', ...
'Position',pos, ...
'DeleteFcn','erp_select_chan({''DELETE_FIG''});', ...
'WindowStyle', 'normal', ...
'Tag','GetFilesFigure', ...
'ToolBar','none');
left_margin = .05;
text_height = .05;
x = left_margin;
y = .9;
w = .34;
h = text_height;
pos = [x y w h];
fnt = 0.5;
h1 = uicontrol('Parent',h0, ... % Channel Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',pos, ...
'String',['Channels: ', num2str(chan_num)], ...
'Tag','ChannelLabel');
x = left_margin+.44;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % Selected Channel Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',pos, ...
'String','Selected Channels: 0', ...
'Tag','SelectedChannelLabel');
h = y - 0.18;
x = left_margin;
y = 0.18;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % Channel Listbox
'Style','listbox', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',0.04, ...
'BackgroundColor',[1 1 1], ...
'HorizontalAlignment','left', ...
'Interruptible', 'off', ...
'Min',1, ...
'Max',10, ...
'ListboxTop',1, ...
'Position',pos, ...
'String', '', ...
'Tag','ChannelList');
x = left_margin+.44;
w = .34;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % Selected Channel Listbox
'Style','listbox', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',0.04, ...
'BackgroundColor',[1 1 1], ...
'HorizontalAlignment','left', ...
'Interruptible', 'off', ...
'Min',1, ...
'Max',10, ...
'ListboxTop',1, ...
'Position',pos, ...
'String', '', ...
'Tag','SelectedChannelList');
x = left_margin + .34 + .01;
y = .5;
w = .08;
h = text_height;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % ">>" Button
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'HorizontalAlignment','center', ...
'String','>>', ...
'Callback','erp_select_chan({''ADD_SESSION_PROFILE''});', ...
'Tag','>>Button');
x = left_margin + .78 + .01;
y = .65;
w = 1-left_margin-x;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % UP Button
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'HorizontalAlignment','center', ...
'String','UP', ...
'Callback','erp_select_chan({''MOVE_UP_PROFILE''});', ...
'Tag','UPButton');
y = y - h;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % DOWN Button
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'HorizontalAlignment','center', ...
'String','DOWN', ...
'Callback','erp_select_chan({''MOVE_DOWN_PROFILE''});', ...
'Tag','DOWNButton');
y = .3;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % REMOVE Button
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'HorizontalAlignment','center', ...
'String','REMOVE', ...
'Callback','erp_select_chan({''REMOVE_SESSION_PROFILE''});', ...
'Tag','REMOVEButton');
x = left_margin;
y = .08;
w = .1;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % CLASS
'style','popupmenu', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'String','ERP|MEG', ...
'value',old_system.class, ...
'Callback','erp_select_chan({''CLASS_BUTTON_PRESSED''});', ...
'visible', view_system, ...
'Tag','CLASSButton');
w = .2;
x = left_margin+.34-w;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % TYPE
'style','popupmenu', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'String',type_str, ...
'value',old_system.type, ...
'Callback','erp_select_chan({''TYPE_BUTTON_PRESSED''});', ...
'visible', view_system, ...
'Tag','TYPEButton');
x = left_margin+.44;
y = .08;
w = .12;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % DONE
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'HorizontalAlignment','center', ...
'String','DONE', ...
'Callback','erp_select_chan({''DONE_BUTTON_PRESSED''});', ...
'Tag','DONEButton');
x = left_margin+.44+.34-w;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ... % CANCEL
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'HorizontalAlignment','center', ...
'String','CANCEL', ...
'Callback','erp_select_chan({''CANCEL_BUTTON_PRESSED''});', ...
'Tag','CANCELButton');
x = .01;
y = 0;
w = 1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Message Line
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'ForegroundColor',[0.8 0.0 0.0], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Tag','MessageLine');
%--------------------------- menu ----------------------
% file
%
h_file = uimenu('parent',h0, ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -