0001 function [Jact, Jback]=vb_load_Jact(proj_root, JactInfo, Session, Trial)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 jactdir = [proj_root JactInfo.jactdir];
0030 Tsample = JactInfo.Tsample;
0031 NJact = JactInfo.NJact;
0032
0033 if ischar(Session)
0034 switch lower(Session)
0035 case 'all'
0036 session = [1:JactInfo.Nsession];
0037 otherwise
0038 error('Invalid value of 3rd argument.');
0039 end
0040 else
0041 session = Session;
0042 end
0043
0044 if ischar(Trial)
0045 switch lower(Trial)
0046 case 'all'
0047 for n = 1:length(session)
0048 trial{n} = [1:JactInfo.Ntrial{session(n)}];
0049 end
0050 otherwise
0051 error('Invalid value of 4th argument.');
0052 end
0053 else
0054 if iscell(Trial)
0055 trial = Trial;
0056 else
0057 trial = {Trial};
0058 end
0059 end
0060
0061
0062 if length(session) ~= length(trial)
0063 error(['Iinvalid usage of this function. Vector length of ''Session''' ...
0064 ' must be same as the number of cell components of ''Trial''.']);
0065 end
0066
0067 nrepeat = 0;
0068 for n = 1:length(session),
0069 nrepeat = nrepeat + length(trial{n});
0070 end;
0071
0072 Jact_tmp = zeros(NJact,Tsample);
0073 Jback_tmp = zeros(NJact,Tsample);
0074 for s = 1:length(session)
0075 for t = trial{s}
0076 fprintf('---- load file : data_s%04dt%04d\n',session(s),t);
0077 fname = [jactdir sprintf('data_s%04dt%04d',session(s),t)];
0078 load(fname,'Jact','Jback');
0079 Jact_tmp = Jact_tmp + (Jact / nrepeat);
0080 Jback_tmp = Jback_tmp + (Jback / nrepeat);
0081 end
0082 end
0083 Jact = Jact_tmp;
0084 Jback = Jback_tmp;
0085 return