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

📄 erp_plot_option_ui.m

📁 绝对经典,老外制作的功能强大的matlab实现PLS_TOOBOX
💻 M
📖 第 1 页 / 共 3 页
字号:
   setappdata(h01,'rescale',getappdata(h0,'rescale'));

   %  the following variable is used to get
   %  "All Subjects in Condition X" and "AllConditions in SubjectX"
   %
   setappdata(h01,'wave_order',wave_order);

   setappdata(h01,'subj_in_cond_grp_corr',subj_in_cond_grp_corr);
   setappdata(h01,'cond_in_subj_grp_corr',cond_in_subj_grp_corr);
   setappdata(h01,'subj_in_cond_grp',subj_in_cond_grp);
   setappdata(h01,'cond_in_subj_grp',cond_in_subj_grp);
   setappdata(h01,'subj_in_cond_lbl',subj_in_cond_lbl);
   setappdata(h01,'cond_in_subj_lbl',cond_in_subj_lbl);

   setappdata(h01,'subj_in_cond_hdl',subj_in_cond_hdl);
   setappdata(h01,'cond_in_subj_hdl',cond_in_subj_hdl);
   setappdata(h01,'subj_in_cond_grp_corr_hdl',subj_in_cond_grp_corr_hdl);
   setappdata(h01,'cond_in_subj_grp_corr_hdl',cond_in_subj_grp_corr_hdl);
   setappdata(h01,'subj_in_cond_grp_hdl',subj_in_cond_grp_hdl);
   setappdata(h01,'cond_in_subj_grp_hdl',cond_in_subj_grp_hdl);

   return;					%  init


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_all: select all the waves
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_all

   wave_lst_hdl = getappdata(gcf, 'wave_lst_hdl');
   wave_selection = 1 : size(get(wave_lst_hdl, 'string'), 1);
   set(wave_lst_hdl, 'value', wave_selection);

   return						% select_all


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_x_tick_interval: select Time axis tick interval
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_x_tick_interval()

   x_tick_interval = getappdata(gcf,'x_tick_interval');
   x_interval_selection = get(x_tick_interval,'value');
   setappdata(gcf, 'x_interval_selection', x_interval_selection);

   return;					% select_x_tick_interval


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_y_tick_interval: select Amplitude tick interval
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_y_tick_interval()

   y_tick_interval = getappdata(gcf,'y_tick_interval');
   y_interval_selection = get(y_tick_interval,'value');
   setappdata(gcf, 'y_interval_selection', y_interval_selection);

   return;					% select_y_tick_interval


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_rescale: select rescale checkbox
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_rescale()

   rescale_hdl = getappdata(gcf,'rescale_hdl');
   rescale = get(rescale_hdl,'value');
   setappdata(gcf, 'rescale', rescale);

   return;					% select_rescale


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   click_ok
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function click_ok

   h01 = gcbf;
   h0 = getappdata(h01,'main_fig');
   view_option = getappdata(h0,'view_option');
   datamat_file = getappdata(h0,'datamat_file');  % get filename for setting
   setting = getappdata(h0,'setting');

   % listbox value are taken now, no callback fcn for listbox
   %
   wave_selection = get(getappdata(h01,'wave_lst_hdl'),'value') - 1;
   if ~isempty(wave_selection)
      setappdata(h01,'wave_selection', wave_selection);
   end

   if view_option == 1
      avg_selection = get(getappdata(h01,'avg_lst_hdl'),'value') - 1;
      if ~isempty(avg_selection)
         setappdata(h01,'avg_selection', avg_selection);
      end
   end

   % collecting setting that may have been changed by callback fcn
   %
   setting.rescale = getappdata(h01,'rescale');
   setting.wave_selection = getappdata(h01,'wave_selection');
   setting.avg_selection = getappdata(h01,'avg_selection');
   setting.x_interval_selection = getappdata(h01,'x_interval_selection');
   setting.y_interval_selection = getappdata(h01,'y_interval_selection');

   if sum(setting.wave_selection)+sum(setting.avg_selection) == 0
      msg = 'ERROR: Please select at least one wave to display';
      msgbox(msg,'ERROR', 'modal');
      return
   end

   old_setting = getappdata(h0, 'setting');

   if isequal(setting,old_setting)		%  nothing was changed
      close(h01);
      return;
   end

   try
      switch view_option
         case {1}				%  subj
            setting1 = setting;
            save(datamat_file, '-append', 'setting1');
         case {2}				%  avg
            setting2 = setting;
            save(datamat_file, '-append', 'setting2');
         case {3}				%  salience
            setting3 = setting;
            save(datamat_file, '-append', 'setting3');
         case {4}				%  grp
            setting4 = setting;
            save(datamat_file, '-append', 'setting4');
         case {5}				%  grp
            setting5 = setting;
            save(datamat_file, '-append', 'setting5');
      end
   catch
      msg = 'Cannot save setting information';
      set(findobj(h01,'Tag','MessageLine'),'String',['ERROR: ', msg]);
      return;
   end;

   setappdata(h0,'rescale',setting.rescale);
   setappdata(h0,'wave_selection',setting.wave_selection);
   setappdata(h0,'avg_selection',setting.avg_selection);
   setappdata(h0,'x_interval_selection',setting.x_interval_selection);
   setappdata(h0,'y_interval_selection',setting.y_interval_selection);

   setappdata(h0,'setting',setting);
   setappdata(h0, 'init_option',[]);

   close(h01);

   old_pointer0 = get(h0,'pointer');
   set(h0,'pointer','watch');

   erp_showplot_ui(h0);

   set(h0,'pointer',old_pointer0);

   return;					% click_ok


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   delete_fig
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function delete_fig(view_option)

   try
      load('pls_profile');
      pls_profile = which('pls_profile.mat');

      if view_option == 1
         erp_plot_option1_pos = get(gcbf,'position');
         save(pls_profile, '-append', 'erp_plot_option1_pos');
      else
         erp_plot_option_pos = get(gcbf,'position');
         save(pls_profile, '-append', 'erp_plot_option_pos');
      end
   catch
   end

   return;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_subj_in_cond
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_subj_in_cond

   subj_in_cond_hdl = getappdata(gcf,'subj_in_cond_hdl');
   wave_order = getappdata(gcf,'wave_order');
   wave_lst_hdl = getappdata(gcf,'wave_lst_hdl');
   avg_lst_hdl = getappdata(gcf,'avg_lst_hdl');
   subj_in_cond = get(subj_in_cond_hdl, 'value') - 1;

   if subj_in_cond ~= 0
      idx = wave_order(find(wave_order(:, 3) == subj_in_cond) ,1);
      set(wave_lst_hdl, 'value', idx);
      set(avg_lst_hdl, 'value', subj_in_cond + 1);
   end

   return;					% select_subj_in_cond


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_cond_in_subj
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_cond_in_subj

   cond_in_subj_hdl = getappdata(gcf,'cond_in_subj_hdl');
   wave_order = getappdata(gcf,'wave_order');
   wave_lst_hdl = getappdata(gcf,'wave_lst_hdl');
   avg_lst_hdl = getappdata(gcf,'avg_lst_hdl');
   cond_in_subj = get(cond_in_subj_hdl, 'value') - 1;

   if cond_in_subj ~= 0
      idx = wave_order(find(wave_order(:, 2) == cond_in_subj) ,1);
      set(wave_lst_hdl, 'value', idx);
      set(avg_lst_hdl, 'value', [1:size(get(avg_lst_hdl,'string'),1)]);
   end

   return;					% select_cond_in_subj


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_subj_in_cond_grp
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_subj_in_cond_grp

   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   set(wave_lst_hdl, 'value', []);
   set(getappdata(gcbf, 'subj_in_cond_grp_hdl'), 'value', 1);
   set(getappdata(gcbf, 'cond_in_subj_grp_hdl'), 'value', 1);

   return;					% select_subj_in_cond_grp


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_cond_in_subj_grp
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_cond_in_subj_grp

   grp = get(getappdata(gcbf, 'cond_in_subj_grp'),'value');

   h0 = getappdata(gcbf, 'main_fig');
   result_file = getappdata(h0,'datamat_file');
   load(result_file, 'datamat_files','common_conditions');
   rri_changepath('erpresult');

   load(datamat_files{grp}, 'session_info', 'selected_subjects');
   subj_name = session_info.subj_name(find(selected_subjects));

   if ~isempty(subj_name)
      set(getappdata(gcbf, 'subj_in_cond_grp_hdl'), 'value', 1);
      set(getappdata(gcbf, 'cond_in_subj_grp_hdl'), 'value', 1, ...
		'string', char([{'(none)'} subj_name]));
   end

   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   set(wave_lst_hdl, 'value', []);

   return;					% select_cond_in_subj_grp


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_subj_in_cond_grp_hdl
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_subj_in_cond_grp_hdl

   grp = get(getappdata(gcbf, 'subj_in_cond_grp'),'value');

   subj_in_cond_grp_hdl = getappdata(gcbf,'subj_in_cond_grp_hdl');
   wave_order = getappdata(gcbf,'wave_order');
   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   num_cond = size(get(subj_in_cond_grp_hdl,'string'), 1) - 1;
   subj_in_cond = (grp - 1) * num_cond + get(subj_in_cond_grp_hdl, 'value') - 1;

   if subj_in_cond ~= 0
      wave_order2 = wave_order(find(wave_order(:, 4) == grp) ,:);
      idx = wave_order2(find(wave_order2(:, 3) == subj_in_cond) ,1);
      set(wave_lst_hdl, 'value', idx);
   end

   return;					% select_subj_in_cond_grp_hdl


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_cond_in_subj_grp_hdl
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_cond_in_subj_grp_hdl

   grp = get(getappdata(gcbf, 'cond_in_subj_grp'),'value');

   cond_in_subj_grp_hdl = getappdata(gcbf,'cond_in_subj_grp_hdl');
   wave_order = getappdata(gcbf,'wave_order');
   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   cond_in_subj = get(cond_in_subj_grp_hdl, 'value') - 1;

   if cond_in_subj ~= 0
      wave_order2 = wave_order(find(wave_order(:, 4) == grp) ,:);
      idx = wave_order2(find(wave_order2(:, 2) == cond_in_subj) ,1);
      set(wave_lst_hdl, 'value', idx);
   end

   return;					% select_cond_in_subj_grp_hdl


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_subj_in_cond_grp_corr
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_subj_in_cond_grp_corr

   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   set(wave_lst_hdl, 'value', []);
   set(getappdata(gcbf, 'subj_in_cond_grp_corr_hdl'), 'value', 1);
   set(getappdata(gcbf, 'cond_in_subj_grp_corr_hdl'), 'value', 1);

   return;					% select_subj_in_cond_grp_corr


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_cond_in_subj_grp_corr
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_cond_in_subj_grp_corr

   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   set(wave_lst_hdl, 'value', []);
   set(getappdata(gcbf, 'subj_in_cond_grp_corr_hdl'), 'value', 1);
   set(getappdata(gcbf, 'cond_in_subj_grp_corr_hdl'), 'value', 1);

   return;					% select_cond_in_subj_grp_corr


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_subj_in_cond_grp_corr_hdl
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_subj_in_cond_grp_corr_hdl

   grp = get(getappdata(gcbf, 'subj_in_cond_grp_corr'),'value');

   subj_in_cond_grp_corr_hdl = getappdata(gcbf,'subj_in_cond_grp_corr_hdl');
   wave_order = getappdata(gcbf,'wave_order');
   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   num_cond = size(get(subj_in_cond_grp_corr_hdl,'string'), 1) - 1;
   subj_in_cond = (grp - 1) * num_cond + get(subj_in_cond_grp_corr_hdl, 'value') - 1;

   if subj_in_cond ~= 0
      wave_order2 = wave_order(find(wave_order(:, 4) == grp) ,:);
      idx = wave_order2(find(wave_order2(:, 3) == subj_in_cond) ,1);
      set(wave_lst_hdl, 'value', idx);
   end

   return;					% select_subj_in_cond_grp_corr_hdl


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   select_cond_in_subj_grp_corr_hdl
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function select_cond_in_subj_grp_corr_hdl

   grp = get(getappdata(gcbf, 'cond_in_subj_grp_corr'),'value');

   cond_in_subj_grp_corr_hdl = getappdata(gcbf,'cond_in_subj_grp_corr_hdl');
   wave_order = getappdata(gcbf,'wave_order');
   wave_lst_hdl = getappdata(gcbf,'wave_lst_hdl');
   cond_in_subj = get(cond_in_subj_grp_corr_hdl, 'value') - 1;

   if cond_in_subj ~= 0
      wave_order2 = wave_order(find(wave_order(:, 4) == grp) ,:);
      idx = wave_order2(find(wave_order2(:, 2) == cond_in_subj) ,1);
      set(wave_lst_hdl, 'value', idx);
   end

   return;					% select_cond_in_subj_grp_corr_hdl

⌨️ 快捷键说明

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