Home > functions > job > job_plot_currentmap_dir > job_plot_cmap_setting_dlg_set_current_file.m

job_plot_cmap_setting_dlg_set_current_file

PURPOSE ^

set current_file, mode(average or raw), trial number to this gui.

SYNOPSIS ^

function [result] = job_plot_cmap_setting_dlg_set_current_file(H,curr_file, mode, trial)

DESCRIPTION ^

 set current_file, mode(average or raw), trial number to this gui.
 [USAGE]
    [result] = 
      job_plot_cmap_setting_dlg_set_current_file(H, curr_file, mode, trial)
 [IN]
    curr_file : cortical current file.
         mode : load mode [string]
                = 'ave'     : load average current
                = 'raw'     : load single trial current
        trial : trial number [integer]
 [OUT]
    result : set result
             = SUCCCESS : set success.
             = FAILURE  : set failure
                          - Specified extension is invalid.
                          - Specified file does not exist.
                            (except the case that the filename is empty.)

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [result] = job_plot_cmap_setting_dlg_set_current_file(H, ...
0002                                                        curr_file, mode, trial)
0003 % set current_file, mode(average or raw), trial number to this gui.
0004 % [USAGE]
0005 %    [result] =
0006 %      job_plot_cmap_setting_dlg_set_current_file(H, curr_file, mode, trial)
0007 % [IN]
0008 %    curr_file : cortical current file.
0009 %         mode : load mode [string]
0010 %                = 'ave'     : load average current
0011 %                = 'raw'     : load single trial current
0012 %        trial : trial number [integer]
0013 % [OUT]
0014 %    result : set result
0015 %             = SUCCCESS : set success.
0016 %             = FAILURE  : set failure
0017 %                          - Specified extension is invalid.
0018 %                          - Specified file does not exist.
0019 %                            (except the case that the filename is empty.)
0020 %
0021 % Copyright (C) 2011, ATR All Rights Reserved.
0022 % License : New BSD License(see VBMEG_LICENSE.txt)
0023 
0024 %
0025 % --- Previous check
0026 %
0027 if ~exist('H', 'var')
0028     error('H is a required parameter.');
0029 end
0030 if ~exist('mode', 'var')
0031     error('mode is a required parameter.');
0032 end
0033 if ~exist('trial', 'var')
0034     error('trial is a required parameter.');
0035 end
0036 
0037 %
0038 % --- Main Procedure
0039 %
0040 result = SUCCESS;
0041 
0042 % Set current_file name
0043 result = job_plot_cmap_setting_dlg_set_file(H, curr_file, 'current_file');
0044 if result == FAILURE, return; end
0045 if isempty(curr_file), return; end
0046 
0047 % Set current info
0048 Jinfo = vb_load_current_info(curr_file);
0049 set(H.max_trial_text, 'String', ['/' num2str(Jinfo.Ntrial)]);
0050 setappdata(H.max_trial_text, 'max', Jinfo.Ntrial);
0051 
0052 set(H.current_file_mode_average_radiobutton, 'Value', 0);
0053 set(H.current_file_mode_raw_radiobutton, 'Value', 0);
0054 
0055 % Set ave/raw mode radiobutton
0056 switch(mode)
0057     case 'ave'
0058       job_plot_cmap_setting_dlg_callback(H, H.current_file_mode_average_radiobutton);
0059     case 'raw'
0060       job_plot_cmap_setting_dlg_callback(H, H.current_file_mode_raw_radiobutton);
0061     otherwise
0062         error('current_mode should be ''ave'' or ''raw''');
0063 end
0064 
0065 % Set trial number
0066 prev_value = getappdata(H.current_file_mode_raw_edit);
0067 
0068 if trial > Jinfo.Ntrial
0069     warning('Specified trial number is larger than trials which current file has.');
0070     trial = 1;
0071 end
0072 set(H.current_file_mode_raw_edit, 'String', num2str(trial));
0073 
0074 % remember correct trial number as a previous valid value.
0075 % This value will be used when the invalid trial index is specified.
0076 setappdata(H.current_file_mode_raw_edit, 'prev', trial);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005