Home > functions > device > active_check > vb_make_fileinfo_good_ch.m

vb_make_fileinfo_good_ch

PURPOSE ^

Make active info file for all trials from active info file with good channel

SYNOPSIS ^

function fileinfo = vb_make_fileinfo_good_ch(datafile,actfile,outfile,mode,cond_list)

DESCRIPTION ^

 Make active info file for all trials from active info file with good channel
 --- 
  fileinfo = vb_make_fileinfo_good_ch(datafile,actfile,outfile,mode,cond_list)
 --- 
 datafile : epoch file name list to select
 actfile : active info file with good channel ([actfile '.info.mat'])
 outfile : output info file  ([outfile '.info.mat'])
 mode    = 'all' : all trials infomation is saved
         = 'good' : trials excluding err_trial infomation is saved
 cond_list : condition number list to select trials
 --- Input/Output file 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.channel_id   : active channel id [1 x (# of acticeChannel)]
 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]
  - The above fields have info. for all trials in multiple epoch files
  - following fields are active trial info.
 fileinfo.act_trial    : active trial index among all trials [1 x Nactive]
 fileinfo.err_trial    : error trial index  [1 x Nerror]

 Masa-aki Sato 2009-08-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    fileinfo = vb_make_fileinfo_good_ch(...
0002                        datafile,actfile,outfile,mode,cond_list)
0003 % Make active info file for all trials from active info file with good channel
0004 % ---
0005 %  fileinfo = vb_make_fileinfo_good_ch(datafile,actfile,outfile,mode,cond_list)
0006 % ---
0007 % datafile : epoch file name list to select
0008 % actfile : active info file with good channel ([actfile '.info.mat'])
0009 % outfile : output info file  ([outfile '.info.mat'])
0010 % mode    = 'all' : all trials infomation is saved
0011 %         = 'good' : trials excluding err_trial infomation is saved
0012 % cond_list : condition number list to select trials
0013 % --- Input/Output file 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.channel_id   : active channel id [1 x (# of acticeChannel)]
0018 % fileinfo.Nsample      : # of samples in one trial
0019 % fileinfo.Ntotal       : # of all trials
0020 % fileinfo.Ntrial       : # of trials for each session [1 x Nsession]
0021 % fileinfo.session_id   : session index for each trial [1 x Ntotal]
0022 % fileinfo.cond_id      : condition number for each trials [1 x Ntotal]
0023 %  - The above fields have info. for all trials in multiple epoch files
0024 %  - following fields are active trial info.
0025 % fileinfo.act_trial    : active trial index among all trials [1 x Nactive]
0026 % fileinfo.err_trial    : error trial index  [1 x Nerror]
0027 %
0028 % Masa-aki Sato 2009-08-10
0029 %
0030 % Copyright (C) 2011, ATR All Rights Reserved.
0031 % License : New BSD License(see VBMEG_LICENSE.txt)
0032 
0033 % get active channel info
0034 load([actfile '.info.mat'], 'fileinfo','Measurement')
0035 
0036 % get all trial info
0037 if ~isempty(datafile)
0038     fileinfo_all = vb_get_multi_fileinfo(datafile);
0039     
0040     fileinfo.filename  = fileinfo_all.filename;
0041     fileinfo.Ntrial    = fileinfo_all.Ntrial   ;
0042     fileinfo.Ntotal    = fileinfo_all.Ntotal   ;
0043     fileinfo.Nsample   = fileinfo_all.Nsample  ;
0044     fileinfo.session_id= fileinfo_all.session_id;
0045     fileinfo.cond_id   = fileinfo_all.cond_id  ;
0046     fileinfo.err_trial = fileinfo_all.err_trial;
0047 end
0048 
0049 if (nargin<4)||isempty(mode), mode='all'; end;
0050 
0051 % Update active info in 'fileinfo'
0052 switch    mode
0053 case    'all'
0054     fileinfo.act_trial = 1:fileinfo.Ntotal;
0055 case    'good'
0056     act_trial = vb_setdiff2([1:fileinfo.Ntotal], fileinfo.err_trial);
0057     fileinfo.act_trial = act_trial;
0058 otherwise
0059     error('Mode string is wrong')
0060 end
0061 
0062 if exist('cond_list','var')
0063     fileinfo = vb_get_active_cond( fileinfo, cond_list );
0064 end
0065 
0066 if isempty(outfile), return; end;
0067 
0068 %fprintf('Save active info to: %s\n',outfile)
0069 
0070 vb_fsave([outfile '.info.mat'],'fileinfo','Measurement');

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