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

📄 pet_session_profile_ui.m

📁 绝对经典,老外制作的功能强大的matlab实现PLS_TOOBOX
💻 M
📖 第 1 页 / 共 3 页
字号:
%PET_SESSION_PROFILE_UI Form to input the group info, including session name,
%		working directory, subjects directories, conditions names etc.
%
%   Usage: pet_session_profile_ui
%
%   See also PLS_SESSION_PROFILE_UI
%

%   Called by plsgui
%
%   I - the action word to call itself recursively. If none, initialize session window.
%   O - none
%
%   Modified on 12-SEP-2002 by Jimmy Shen
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function pet_session_profile_ui(varargin)

   if nargin == 0,

      if exist('plslog.m','file')
         plslog('Edit PET Session');
      end

      curr = pwd;
      if isempty(curr)
         curr = filesep;
      end

      start_dir = curr;

      init;

      setappdata(gcf,'CallingFigure',gcbf);
      set(gcbf,'visible','off');

      uiwait(gcf);			% wait for user finish

      close(gcf);

%      cd(start_dir);
      return;
   end;

   %  clear the message line,
   %
   h = findobj(gcf,'Tag','MessageLine');
   set(h,'String','');

   action = upper(varargin{1});

   if strcmp(action,'MENU_LOAD_PLS_SESSION_INFO'),
      LoadSessionInfo;
      ShowSessionInfo;
   elseif strcmp(action,'MENU_SAVE_PLS_SESSION_INFO'),
      SaveSessionInfo(0);
   elseif strcmp(action,'MENU_SAVE_AS_PLS_SESSION_INFO'),
      SaveSessionInfo(1);
   elseif strcmp(action,'MENU_CLOSE_SESSION_INPUT'),
      if (CloseSessionInput == 1);
         uiresume;
      end
   elseif strcmp(action,'MENU_CLEAR_PLS_SESSION_INFO'),
      ClearSessionInfo(0);
      ShowSessionInfo;
   elseif strcmp(action,'MENU_PATH_PLS_SESSION_INFO'),
      PathSessionInfo(0);
      ShowSessionInfo;
   elseif strcmp(action,'MENU_CREATE_DATAMAT'),
      CreateDatamat;
   elseif strcmp(action,'MENU_MODIFY_BEHAV'),
      ModifyBehav;
   elseif strcmp(action,'EDIT_DESCRIPTION'),
      description = deblank(strjust(get(gcbo,'String'),'left'));
      set(gcbo,'String',description);
      setappdata(gcf,'SessionDescription',description);
   elseif strcmp(action,'EDIT_PLS_DATA_DIR'),
      EditPLSDataDir;
   elseif strcmp(action,'SELECT_PLS_DATA_DIR'),
      SelectPLSDataDir;
   elseif strcmp(action,'EDIT_BEHAV_DATA_FILE'),
      is_dir_empty = isempty(getappdata(gcf,'SessionPLSDir'));
      if is_dir_empty
         msg = 'A working directory needs to be specified before inputting conditions.';
         set(findobj(gcf,'Tag','MessageLine'),'String',msg);
         return;
      end
      EditBehavDataFile;
   elseif strcmp(action,'SELECT_BEHAV_DATA_FILE'),
      is_dir_empty = isempty(getappdata(gcf,'SessionPLSDir'));
      if is_dir_empty
         msg = 'A working directory needs to be specified before inputting conditions.';
         set(findobj(gcf,'Tag','MessageLine'),'String',msg);
         return;
      end
      SelectBehavDataFile;
   elseif strcmp(action,'EDIT_DATAMAT_PREFIX'),
      prefix_name = deblank(strjust(get(gcbo,'String'),'left'));
      setappdata(gcf,'SessionDatamatPrefix',prefix_name);
   elseif strcmp(action,'EDIT_CONDITIONS_NUM'),
      msg = 'Click the "Input Conditions ..." button to set the condition names';
      set(findobj(gcf,'Tag','MessageLine'),'String',msg);
   elseif strcmp(action,'EDIT_CONDITIONS'),
      is_dir_empty = isempty(getappdata(gcf,'SessionPLSDir'));
      if is_dir_empty
         msg = 'A working directory needs to be specified before inputting conditions.';
         set(findobj(gcf,'Tag','MessageLine'),'String',msg);
         return;
      end
      EditConditions;
   elseif strcmp(action,'EDIT_NUM_SUBJECTS'),
      msg = 'Click the "Select Subjects ..." button to set the subject directory';
      set(findobj(gcf,'Tag','MessageLine'),'String',msg);
   elseif strcmp(action,'EDIT_SUBJECTS'),
      is_cond_empty = ...
         strcmp(get(findobj(gcf,'Tag','NumberConditionsEdit'),'String'),'0');
      if is_cond_empty
         msg = 'Conditions need to be selected before selecting object.';
         set(findobj(gcf,'Tag','MessageLine'),'String',msg);
         return;
      end
      EditSubjects;
   elseif strcmp(action,'RESIZE_FIGURE'),
      ResizeFigure;
   elseif strcmp(action,'DELETE_FIG'),
       delete_fig;
   elseif strcmp(action,'DELETE_FIGURE'),
       delete_figure;
   elseif strcmp(action,'EDIT_NUM_BEHAVIOR'),
      msg = 'Click the "Edit Behavior Data ..." button to edit behavior data';
      set(findobj(gcf,'Tag','MessageLine'),'String',msg);
   elseif strcmp(action,'EDIT_BEHAV_DATA'),
      is_dir_empty = isempty(getappdata(gcf,'SessionPLSDir'));
      if is_dir_empty
         msg = 'A working directory needs to be specified before inputting conditions.';
         set(findobj(gcf,'Tag','MessageLine'),'String',msg);
         return;
      end
      behavdata = getappdata(gcf,'SessionBehavData');
      behavname = getappdata(gcf,'SessionBehavName');
      [behavdata, behavname] = rri_edit_behav(num2str(behavdata), behavname, 'Edit Behavior Data');
      setappdata(gcf,'SessionBehavData',str2num(behavdata));
      setappdata(gcf,'SessionBehavName',behavname);
      setappdata(gcf,'SessionNumBehavior',size(str2num(behavdata), 1));
      set(findobj(gcf,'Tag','NumberBehaviorEdit'),'String',size(str2num(behavdata),1));
   end;

   return;


%----------------------------------------------------------------------------
function init

   save_setting_status = 'on';
   pet_session_profile_pos = [];

   try
      load('pls_profile');
   catch
   end

   if ~isempty(pet_session_profile_pos) & strcmp(save_setting_status,'on')

      pos = pet_session_profile_pos;

   else

      w = 0.65;
      h = 0.4;
      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','New PET Session Information', ...
        'NumberTitle','off', ...
        'Menubar', 'none', ...
   	'Position', pos, ...
        'DeleteFcn','pet_session_profile_ui(''DELETE_FIGURE'');', ...
	'Tag','EditSessionInformation', ...
   	'ToolBar','none');

   % numbers of inputing line excluding 'MessageLine'

   num_inputline = 4;
   factor_inputline = 1/(num_inputline+1);

   % left label

   x = 0.05;
   y = (num_inputline-0) * factor_inputline;
   w = 0.25;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   fnt = 0.5;

   c = uicontrol('Parent',h0, ...		% Session Description Label
   	'Style','text', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','right', ...
   	'Position',pos, ...
   	'String','Session Description: ', ...
   	'Tag','SessionDescriptionLabel');

   x = x+w+0.01;
   w = 0.59;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Session Description Edit
   	'Style','edit', ...
   	'Units','normal', ...
   	'BackgroundColor',[1 1 1], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','left', ...
   	'Position',pos, ...
   	'String','', ...
   	'Callback','pet_session_profile_ui(''EDIT_DESCRIPTION'');', ...
   	'Tag','SessionDescriptionEdit');

   x = 0.05;
   y = (num_inputline-1) * factor_inputline;
   w = 0.25;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% PLS Data Directory Label
   	'Style','text', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','right', ...
   	'Position',pos, ...
   	'String','*  Working Directory: ', ...
	'visible','off', ...
   	'Tag','PLSDataDirectoryLabel');

   x = x+w+0.01;
   w = 0.43;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% PLS Data Directory Edit
   	'Style','edit', ...
   	'Units','normal', ...
   	'BackgroundColor',[1 1 1], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','left', ...
   	'Position',pos, ...
   	'String','                  *  REQUIRED FIELD', ...
   	'Callback','pet_session_profile_ui(''EDIT_PLS_DATA_DIR'');', ...
	'visible','off', ...
   	'Tag','PLSDataDirectoryEdit');

   x = x+w+0.01;
   w = 0.15;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% PLS Data Directory Button
   	'Style','pushbutton', ...
        'Units','normal', ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
        'Position',pos, ...
        'String','Browse ...', ...
        'Enable','On', ...
   	'Callback','pet_session_profile_ui(''SELECT_PLS_DATA_DIR'');', ...
	'visible','off', ...
   	'Tag','PLSDataDirectoryButton');

   x = 0.05;
   y = (num_inputline-1) * factor_inputline;
   w = 0.25;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Datamat Prefix Label
   	'Style','text', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','right', ...
   	'Position',pos, ...
   	'String','*  Datamat Prefix: ', ...
   	'Tag','DatamatPrefixLabel');

   x = x+w+0.01;
   w = 0.3;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Datamat Prefix Edit
   	'Style','edit', ...
   	'Units','normal', ...
   	'BackgroundColor',[1 1 1], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','left', ...
   	'Position',pos, ...
   	'String','', ...
   	'Callback','pet_session_profile_ui(''EDIT_DATAMAT_PREFIX'');', ...
   	'Tag','DatamatPrefixEdit');

   x = 0.05;
   y = (num_inputline-2) * factor_inputline;
   w = 0.25;
   h = 0.5 * factor_inputline;

   pos = [x y w h];






   c = uicontrol('Parent',h0, ...		% Behav Data Label
   	'Style','text', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','right', ...
   	'Position',pos, ...
   	'String','Behavior Data:', ...
	'enable', 'on', ...
	'visible', 'off', ...
   	'Tag','BehavDataLabel');

   x = x+w+0.01;
   w = 0.07;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Number of Behavior Edit
   	'Style','edit', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.9 0.9 0.9], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','left', ...
   	'Position',pos, ...
   	'String','0', ...
   	'ButtonDownFcn','erp_session_profile_ui(''EDIT_NUM_BEHAVIOR'');', ...
	'enable', 'inactive', ...
	'visible', 'off', ...
   	'Tag','NumberBehaviorEdit');

   x = x+w+0.01;
   w = 0.22;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Behav Data Edit
   	'Units','normal', ...
	'string', 'Edit Behavior Data...', ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'Position',pos, ...
	'callback','erp_session_profile_ui(''EDIT_BEHAV_DATA'');', ...
	'enable', 'on', ...
	'visible', 'off', ...
   	'Tag','BehavDataEdit');




if(0)
   x = 0.05;
   y = (num_inputline-2) * factor_inputline;
   w = 0.25;
   h = 0.4 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Behav Data File Label
   	'Style','text', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','right', ...
   	'Position',pos, ...
   	'String','Behavior Data File: ', ...
	'enable', 'on', ...
   	'Tag','BehavDataFileLabel');

   x = x+w+0.01;
   w = 0.43;
   h = 0.4 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Behav Data File Edit
   	'Style','edit', ...
   	'Units','normal', ...
   	'BackgroundColor',[1 1 1], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','left', ...
   	'Position',pos, ...
   	'String','', ...
   	'Callback','pet_session_profile_ui(''EDIT_BEHAV_DATA_FILE'');', ...
   	'Tag','BehavDataFileEdit');

   x = x+w+0.01;
   w = 0.15;
   h = 0.4 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Behav Data File Button
   	'Style','pushbutton', ...
        'Units','normal', ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
        'Position',pos, ...
        'String','Browse ...', ...
        'Enable','On', ...
   	'Callback','pet_session_profile_ui(''SELECT_BEHAV_DATA_FILE'');', ...
	'enable', 'on', ...
   	'Tag','BehavDataFileButton');
end

   x = 0.05;
   y = (num_inputline-2) * factor_inputline;
   w = 0.25;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Number of Conditions Label
   	'Style','text', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'FontUnits','normal', ...
   	'FontSize',fnt, ...
   	'HorizontalAlignment','right', ...
   	'Position',pos, ...
   	'String','*  Number of Conditions: ', ...
   	'Tag','NumberConditionsLabel');

   x = x+w+0.01;
   w = 0.07;
   h = 0.5 * factor_inputline;

   pos = [x y w h];

   c = uicontrol('Parent',h0, ...		% Number of Conditions Edit
   	'Style','edit', ...

⌨️ 快捷键说明

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