load estimated current USAGE: [Jact,ix_act] = vb_load_current_j(currfile,ave_mode,trial,ix_area) --- INPUT: currfile - current file name --- Optional INPUT: ave_mode : trial average mode = ON : trial average is done = OFF : No trial average trial : trial number to load if empty, all trials are loaded ix_area : (absolute) vertex index to load if empty, all vertices are loaded --- OUTPUT: ix_act : Vertex index corresponding to current Jact : current in focal region (J-current) Jact(Nact,Nsample) for ave_mode = ON Jact(Nact,Nsample,Ntrials) for ave_mode = OFF Nact = Lact * Nvact, Nvact = length(ix_act) Nsample : # of time sample, Ntrials : # of trials in all session] Jact( n + Nvact*(i-1), t, :) current at the vertex 'ix_act(n)', 'i-th' direction, time index 't' Time sample in MEG data : t_meg = Tsample(t) Time (ms) in MEG data : t_ms = (t_meg - Pretrigger)*(1000/SampleFreq) 2007-3-5 Masa-aki Sato 2008-7-9 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Jact,ix_act] = vb_load_current_j(currfile,ave_mode,trial,ix_area); 0002 % load estimated current 0003 % 0004 % USAGE: 0005 % [Jact,ix_act] = vb_load_current_j(currfile,ave_mode,trial,ix_area) 0006 % 0007 % --- INPUT: 0008 % currfile - current file name 0009 % --- Optional INPUT: 0010 % ave_mode : trial average mode 0011 % = ON : trial average is done 0012 % = OFF : No trial average 0013 % trial : trial number to load 0014 % if empty, all trials are loaded 0015 % ix_area : (absolute) vertex index to load 0016 % if empty, all vertices are loaded 0017 % --- OUTPUT: 0018 % ix_act : Vertex index corresponding to current 0019 % Jact : current in focal region (J-current) 0020 % Jact(Nact,Nsample) for ave_mode = ON 0021 % Jact(Nact,Nsample,Ntrials) for ave_mode = OFF 0022 % Nact = Lact * Nvact, Nvact = length(ix_act) 0023 % Nsample : # of time sample, 0024 % Ntrials : # of trials in all session] 0025 % 0026 % Jact( n + Nvact*(i-1), t, :) 0027 % current at the vertex 'ix_act(n)', 'i-th' direction, time index 't' 0028 % 0029 % Time sample in MEG data : t_meg = Tsample(t) 0030 % Time (ms) in MEG data : t_ms = (t_meg - Pretrigger)*(1000/SampleFreq) 0031 % 0032 % 0033 % 2007-3-5 Masa-aki Sato 0034 % 2008-7-9 Masa-aki Sato 0035 % 0036 % Copyright (C) 2011, ATR All Rights Reserved. 0037 % License : New BSD License(see VBMEG_LICENSE.txt) 0038 0039 if ~exist('ave_mode','var'), ave_mode = ON; end; 0040 if ~exist('trial','var'), trial = []; end; 0041 if ~exist('ix_area','var'), ix_area = []; end; 0042 0043 load(currfile) 0044 0045 if ~exist('Jact','var') 0046 if exist('J','var') 0047 % ver 0.1 0048 % save(parm.currfile,'J','ix0'); 0049 Jact = J; 0050 ix_act = ix0; 0051 else 0052 error(['There is no Jact in ' currfile]) 0053 end 0054 end 0055 0056 [NJ, T, Ntrial] = size(Jact); 0057 if isempty(trial), trial = 1:Ntrial; end; 0058 0059 % find selected area index 0060 Jinfo = vb_load_current_info(currfile); 0061 [ix_act, jx_act] = vb_current_area_info(Jinfo,ix_area); 0062 0063 Jact = Jact(jx_act,:,trial); 0064 0065 if ave_mode==ON, 0066 Jact = mean(Jact,3); 0067 end 0068