Home > vbmeg > functions > device > active_check > vb_save_active_info.m

vb_save_active_info

PURPOSE ^

Save active info for multiple session file data

SYNOPSIS ^

function vb_save_active_info(fileinfo, outfile, cond_list, session_no)

DESCRIPTION ^

 Save active info for multiple session file data
   vb_save_active_info(fileinfo, outfile, cond_list, session_no)
 --- Input 
 fileinfo : file information for multiple session files
 outfile  : Output file name (saved variable : 'fileinfo')
 --- Optional Input 
 cond_list  : list of condition number to select
              if empty, all conditions are selected
 session_no : session number to select
              if empty, all sessions are selected
 
 --- Saved variable
 fileinfo : structure with file information for multiple files
 fileinfo.filename{n}  : n-th session data file names [n=1:Nsession]
 fileinfo.Nchannel     : # of total channels
 fileinfo.Nsample      : # of samples in one trial
 fileinfo.Ntotal       : # of all trials 
 fileinfo.Ntrial       : # of trials for each session [1 x Nsession]
 fileinfo.session_id   : session index for each trial [1 x Ntotal]
 fileinfo.cond_id      : condition number for each trials [1 x Ntotal]
 fileinfo.ActiveChannel: Active channel list (boolean array) [Nchannel x 1]
 fileinfo.ActiveTrial  : Active trial list   (boolean array) [Ntotal x 1]

 Masa-aki Sato 2008-8-10

 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    vb_save_active_info(fileinfo, outfile, cond_list, session_no)
0002 % Save active info for multiple session file data
0003 %   vb_save_active_info(fileinfo, outfile, cond_list, session_no)
0004 % --- Input
0005 % fileinfo : file information for multiple session files
0006 % outfile  : Output file name (saved variable : 'fileinfo')
0007 % --- Optional Input
0008 % cond_list  : list of condition number to select
0009 %              if empty, all conditions are selected
0010 % session_no : session number to select
0011 %              if empty, all sessions are selected
0012 %
0013 % --- Saved variable
0014 % fileinfo : structure with file information for multiple files
0015 % fileinfo.filename{n}  : n-th session data file names [n=1:Nsession]
0016 % fileinfo.Nchannel     : # of total channels
0017 % fileinfo.Nsample      : # of samples in one trial
0018 % fileinfo.Ntotal       : # of all trials
0019 % fileinfo.Ntrial       : # of trials for each session [1 x Nsession]
0020 % fileinfo.session_id   : session index for each trial [1 x Ntotal]
0021 % fileinfo.cond_id      : condition number for each trials [1 x Ntotal]
0022 % fileinfo.ActiveChannel: Active channel list (boolean array) [Nchannel x 1]
0023 % fileinfo.ActiveTrial  : Active trial list   (boolean array) [Ntotal x 1]
0024 %
0025 % Masa-aki Sato 2008-8-10
0026 %
0027 % Copyright (C) 2011, ATR All Rights Reserved.
0028 % License : New BSD License(see VBMEG_LICENSE.txt)
0029 
0030 if nargin < 2, 
0031     help vb_save_active_info
0032     error('Input argument error'); 
0033 end;
0034 
0035 if nargin < 3, cond_list  = [];end
0036 if nargin < 4, session_no = [];end
0037 
0038 %if ~exist('cond_list','var'), cond_list = []; end;
0039 %if ~exist('session_no','var'), session_no = []; end;
0040 
0041 % select condition & session
0042 fileinfo = vb_get_active_cond(fileinfo,cond_list,session_no);
0043 
0044 Measurement = 'INFO';
0045 
0046 fprintf('Total %d channel & %d epoch\n',fileinfo.Nchannel, fileinfo.Ntotal)
0047 if isfield(fileinfo, 'channel_id')
0048     fprintf('Good  %d channel & %d epoch\n',...
0049         length(fileinfo.channel_id), length(fileinfo.act_trial));
0050 else
0051     fprintf('Good  %d channel & %d epoch\n',...
0052         length(find(fileinfo.ActiveChannel==1)), length(find(fileinfo.ActiveTrial==1)));
0053 end
0054 fprintf('Save active info to: \n%s\n',outfile)
0055 
0056 vb_fsave(outfile, 'fileinfo','Measurement');

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005