📄 erp_plot_scores_ui.m
字号:
if ~isempty(l_hdls) & ishandle(l_hdls{1}),
set(l_hdls{1},'Visible',on_off);
num_obj = length(l_hdls{2});
for i=1:num_obj,
set(l_hdls{2}(i),'Visible',on_off);
end;
end
if ~isempty(l_hdls2) & ishandle(l_hdls2{1})
set(l_hdls2{1},'Visible',on_off);
num_obj = length(l_hdls2{2});
for i=1:num_obj,
set(l_hdls2{2}(i),'Visible',on_off);
end;
end
if ~isempty(l_hdls3) & ishandle(l_hdls3{1})
set(l_hdls3{1},'Visible',on_off);
num_obj = length(l_hdls3{2});
for i=1:num_obj,
set(l_hdls3{2}(i),'Visible',on_off);
end;
end
return; % DisplayLegend
%---------------------------------------------------------------------------
function ToggleScalpDesignScores
brain_design_state = getappdata(gcf,'PlotScalpDesignState');
is_design_plot = getappdata(gcf, 'is_design_plot');
switch (brain_design_state)
case {0},
if is_design_plot
m_hdl = findobj(gcf,'Tag','ScalpDesignMenu');
set(m_hdl,'Label','Hide &Scalp vs Design Scores');
else
m_hdl = findobj(gcf,'Tag','ScalpBehavMenu');
set(m_hdl,'Label','Hide &Scalp vs Behavior Scores');
end
setappdata(gcf,'PlotScalpDesignState',1);
DisplayScalpDesignScores('on');
% set(findobj(gcf,'Tag','LegendMenu'),'Enable','on');
setappdata(gcf,'PlotDesignLVState',0);
if is_design_plot
m_hdl = findobj(gcf,'Tag','DesignLVMenu');
set(m_hdl,'Label','Show Design &Latent Variables');
else
m_hdl = findobj(gcf,'Tag','BehavLVMenu');
set(m_hdl,'Label','Show Behavior &Latent Variables');
end
case {1},
if is_design_plot
m_hdl = findobj(gcf,'Tag','ScalpDesignMenu');
set(m_hdl,'Label','Show &Scalp vs Design Scores');
else
m_hdl = findobj(gcf,'Tag','ScalpDesignMenu');
set(m_hdl,'Label','Show &Scalp vs Behavior Scores');
end
setappdata(gcf,'PlotScalpDesignState',0);
DisplayScalpDesignScores('off');
% set(findobj(gcf,'Tag','LegendMenu'),'Enable','off');
end;
return; % ToggleScalpDesignScores
%---------------------------------------------------------------------------
function DisplayScalpDesignScores(on_off)
design_state = getappdata(gcf,'PlotDesignState');
switch (on_off)
case {'on'},
if (design_state == 1), % need to display design scores
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','off');
set(getappdata(gcf,'top_axes'),'Visible','on');
PlotDesignScores;
set(getappdata(gcf,'bottom_axes'),'Visible','on');
PlotScalpDesignScores;
else
h = getappdata(gcf,'top_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'bottom_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','on');
PlotScalpDesignScores;
end;
case {'off'},
old_legend = getappdata(gcf,'LegendHdl');
if ~isempty(old_legend),
try
delete(old_legend{1});
catch
end;
end;
% DisplayLegend('off');
if (design_state == 1)
h = getappdata(gcf,'top_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'bottom_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','on');
PlotDesignScores;
else
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','off');
end;
end; % switch
return; % DisplayScalpDesignScores
%---------------------------------------------------------------------------
function ToggleDesignScores
design_state = getappdata(gcf,'PlotDesignState');
is_design_plot = getappdata(gcf, 'is_design_plot');
switch (design_state)
case {0},
if is_design_plot
m_hdl = findobj(gcf,'Tag','DesignMenu');
set(m_hdl,'Label','Hide &Design Scores');
setappdata(gcf,'PlotDesignState',1);
DisplayDesignScores('on');
setappdata(gcf,'PlotDesignLVState',0);
m_hdl = findobj(gcf,'Tag','DesignLVMenu');
set(m_hdl,'Label','Show Design &Latent Variables');
else
m_hdl = findobj(gcf,'Tag','BehavMenu');
set(m_hdl,'Label','Hide &Behavior Scores');
setappdata(gcf,'PlotDesignState',1);
DisplayDesignScores('on');
setappdata(gcf,'PlotDesignLVState',0);
m_hdl = findobj(gcf,'Tag','BehavLVMenu');
set(m_hdl,'Label','Show Behavior &Latent Variables');
end
case {1},
new_state = 0;
if is_design_plot
m_hdl = findobj(gcf,'Tag','DesignMenu');
set(m_hdl,'Label','Show &Design Scores');
else
m_hdl = findobj(gcf,'Tag','BehavMenu');
set(m_hdl,'Label','Show &Behavior Scores');
end
setappdata(gcf,'PlotDesignState',0);
DisplayDesignScores('off');
end;
return; % ToggleDesignScores
%---------------------------------------------------------------------------
function DisplayDesignScores(on_off)
brain_design_state = getappdata(gcf,'PlotScalpDesignState');
switch (on_off)
case {'on'},
if (brain_design_state == 1), % need to display brain/design scores
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','off');
set(getappdata(gcf,'top_axes'),'Visible','on');
PlotDesignScores;
set(getappdata(gcf,'bottom_axes'),'Visible','on');
PlotScalpDesignScores;
else
h = getappdata(gcf,'top_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'bottom_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','on');
PlotDesignScores;
end;
case {'off'},
old_legend = getappdata(gcf,'LegendHdl2');
if ~isempty(old_legend),
try
delete(old_legend{1});
catch
end;
end;
if (brain_design_state == 1), % need to display brain/design scores
h = getappdata(gcf,'top_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'bottom_axes');
axes(h); cla; set(h,'Visible','off');
set(getappdata(gcf,'main_axes'),'Visible','on');
PlotScalpDesignScores;
else
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','off');
end;
end; % switch
return; % DisplayDesignScores
%---------------------------------------------------------------------------
function ToggleDesignLV
designlv_state = getappdata(gcf,'PlotDesignLVState');
is_design_plot = getappdata(gcf, 'is_design_plot');
switch (designlv_state)
case {0},
if is_design_plot
setappdata(gcf,'PlotScalpDesignState',0);
m_hdl = findobj(gcf,'Tag','ScalpDesignMenu');
set(m_hdl,'Label','Show &Scalp vs Design Scores');
DisplayScalpDesignScores('off');
setappdata(gcf,'PlotDesignState',0);
m_hdl = findobj(gcf,'Tag','DesignMenu');
set(m_hdl,'Label','Show &Design Scores');
DisplayDesignScores('off');
m_hdl = findobj(gcf,'Tag','DesignLVMenu');
set(m_hdl,'Label','Hide Design &Latent Variables');
setappdata(gcf,'PlotDesignLVState',1);
DisplayDesignLV('on');
else
setappdata(gcf,'PlotScalpDesignState',0);
m_hdl = findobj(gcf,'Tag','ScalpBehavMenu');
set(m_hdl,'Label','Show &Scalp vs Behavior Scores');
DisplayScalpDesignScores('off');
setappdata(gcf,'PlotDesignState',0);
m_hdl = findobj(gcf,'Tag','BehavMenu');
set(m_hdl,'Label','Show &Behavior Scores');
DisplayDesignScores('off');
m_hdl = findobj(gcf,'Tag','BehavLVMenu');
set(m_hdl,'Label','Hide Behavior &Latent Variables');
setappdata(gcf,'PlotDesignLVState',1);
DisplayDesignLV('on');
end
% set(findobj(gcf,'Tag','LegendMenu'),'Enable','off');
case {1},
new_state = 0;
if is_design_plot
m_hdl = findobj(gcf,'Tag','DesignLVMenu');
set(m_hdl,'Label','Show Design &Latent Variables');
setappdata(gcf,'PlotDesignLVState',0);
DisplayDesignLV('off');
setappdata(gcf,'PlotDesignState',1);
m_hdl = findobj(gcf,'Tag','DesignMenu');
set(m_hdl,'Label','Hide &Design Scores');
DisplayDesignScores('on');
setappdata(gcf,'PlotScalpDesignState',1);
m_hdl = findobj(gcf,'Tag','ScalpDesignMenu');
set(m_hdl,'Label','Hide &Scalp vs Design Scores');
DisplayScalpDesignScores('on');
else
m_hdl = findobj(gcf,'Tag','BehavLVMenu');
set(m_hdl,'Label','Show Behavior &Latent Variables');
setappdata(gcf,'PlotDesignLVState',0);
DisplayDesignLV('off');
setappdata(gcf,'PlotDesignState',1);
m_hdl = findobj(gcf,'Tag','BehavMenu');
set(m_hdl,'Label','Hide &Behavior Scores');
DisplayDesignScores('on');
setappdata(gcf,'PlotScalpDesignState',1);
m_hdl = findobj(gcf,'Tag','ScalpBehavMenu');
set(m_hdl,'Label','Hide &Scalp vs Behavior Scores');
DisplayScalpDesignScores('on');
end
end;
return; % ToggleDesignLV
%---------------------------------------------------------------------------
function DisplayDesignLV(on_off)
design_state = getappdata(gcf,'PlotDesignState');
brain_design_state = getappdata(gcf,'PlotScalpDesignState');
switch (on_off)
case {'on'},
if (design_state == 1)
ToggleDesignScores;
end;
if (brain_design_state == 1)
ToggleScalpDesignScores;
end;
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'top_axes');
axes(h); cla; set(h,'Visible','on');
h = getappdata(gcf,'bottom_axes');
axes(h); cla; set(h,'Visible','on');
PlotDesignLV;
case {'off'},
old_legend = getappdata(gcf,'LegendHdl3');
if ~isempty(old_legend),
try
delete(old_legend{1});
catch
end;
end;
h = getappdata(gcf,'main_axes');
axes(h); cla; set(h,'Visible','off');
h = getappdata(gcf,'top_axes');
axes(h); cla; set(h,'Visible','off');
% PlotDesignScores;
h = getappdata(gcf,'bottom_axes');
axes(h); cla; set(h,'Visible','off');
PlotScalpDesignScores;
end; % switch
return; % DesignLV
%---------------------------------------------------------------------------
function [scalpscores, designscores, designlv, ...
common_conditions, cond_name, subj_name_lst, ...
num_cond_lst, num_subj_lst, s, perm_result, datamat_files, num_grp] = ...
load_pls_scores(result_file, is_design_plot);
scalpscores = [];
designscores = [];
designlv = [];
common_conditions = [];
cond_name = [];
subj_name_lst = [];
num_cond_lst = [];
num_subj_lst = [];
s = [];
perm_result = [];
datamat_files = [];
num_grp = 1;
if ~exist('result_file','var') | isempty(result_file),
pattern = 'ERPresult*.mat';
[result_file, path] = uigetfile(pattern, 'Load ERP results');
if isequal(result_file, 0),
return;
end;
result_file = [path, result_file];
end;
try
warning off;
if(is_design_plot)
load(result_file, 'scalpscores', 'designscores', 'designlv', ...
'common_conditions', 'cond_name', 'subj_name_lst', ...
'b_scores', 'num_cond_lst', 'num_subj_lst', 's', ...
'perm_result', 'datamat_files');
else
load(result_file, 'scalpscores', 'behavscores', 'behavlv', ...
'common_conditions', 'cond_name', 'subj_name_lst', ...
'b_scores', 'num_cond_lst', 'num_subj_lst', 's', ...
'perm_result', 'datamat_files');
designscores = behavscores;
designlv = behavlv;
end
warning on;
catch
msg = sprintf('Cannot load the PLS result from file: %s', result_file);
msgbox(['ERROR: ' msg],'modal');
return;
end;
rri_changepath('erpresult');
if exist('b_scores','var')
scalpscores = b_scores;
end
if isempty(num_subj_lst)
num_grp = 1;
else
num_grp = length(num_subj_lst);
end
return; % load_pls_scores
%---------------------------------------------------------------------------
function delete_fig(),
try
load('pls_profile');
pls_profile = which('pls_profile.mat');
erp_plot_scores_pos = get(gcbf,'position');
save(pls_profile, '-append', 'erp_plot_scores_pos');
catch
end
h0 = gcbf;
axis_fig = getappdata(h0,'axis_fig');
dlv_fig = getappdata(h0,'dlv_fig');
try
if ishandle(axis_fig)
delete(axis_fig);
end
if ishandle(dlv_fig)
delete(dlv_fig);
end
catch
end
subj_select_lst = getappdata(gcbf, 'subj_select_lst');
old_subj_select_lst = getappdata(gcbf, 'old_subj_select_lst');
main_fig = getappdata(gcbf,'main_fig');
hm_score = getappdata(main_fig,'hm_score');
set(hm_score, 'userdata',0, 'check','off');
if ~isequal(subj_select_lst, old_subj_select_lst)
dlg_title = 'Confirm datamat modification';
msg = ['Some subjects have been removed, do you want to modify the datamat?'];
response = questdlg(msg,dlg_title,'Yes','No','Yes');
if(strcmp(response,'Yes'))
erp_plot_scores_ui('modify_datamat');
end
end
return; % delete_fig
%------------------------------------------------
function toggle_axis
hm_axis = getappdata(gcf,'hm_axis');
axis_status = get(hm_axis,'userdata');
if ~axis_status % was not checked
set(hm_axis, 'userdata',1, 'check','on');
view_axis;
else
set(hm_axis, 'userdata',0, 'check','off');
try
axis_fig_name = get(getappdata(gcf,'axis_fig'),'name');
if ~isempty(axis_fig_name) & strcmp(axis_fig_name,'Current Axis')
close(getappdata(gcf,'axis_fig'));
end
catch
end
end
return; % toggle_axis
%--------------------------------------------------
function view_axis
h0 = gcf;
axis_old = gca;
if ~ischar(get(axis_old,'userdata')) | (...
~strcmp(get(axis_old,'userdata'),'PlotScalpDesignScores') ...
& ~strcmp(get(axis_old,'userdata'),'PlotDesignScores') ...
& ~strcmp(get(axis_old,'userdata'),'topPlotDesignLV') ...
& ~strcmp(get(axis_old,'userdata'),'bottomPlotDesignLV'))
msgbox('Please click a plot in PLS Scores Plot.', 'modal');
hm_axis = getappdata(h0,'hm_axis');
set(hm_axis, 'userdata',0, 'check','off');
return;
end
axis_fig_name = [];
try
axis_fig_name = get(getappdata(h0,'axis_fig'),'name');
catch
end
if ~isempty(axis_fig_name) & strcmp(axis_fig_name,'Current Axis')
msg = 'ERROR: Current Axis window has already been opened.';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -