Home > functions > estimation > bayes > vb_check_variable.m

vb_check_variable

PURPOSE ^

Check variable consistency

SYNOPSIS ^

function vb_check_variable(B, Cov, Gact, Gall)

DESCRIPTION ^

 Check variable consistency
  vb_check_varible(B, Cov, Gact, Gall)
 -- Input
 B{Nsession} : MEG magnetic field data matrix
                   size(B{i}) = [Nsensors(i), Tsample, Ntrials(i)]
 Gall{Nsession}: Lead field for whole brain region as background activity
                   size(Gall{i}) = [Nsensors(i) Ndipole]
                  If Gall = [], the sparse-mode (focal dipoles only) is
                  executed.
 Gact{Nsession} : Lead field (Current basis function)
                  for region with high estimation accuracy 
                   size(Gact{i})  = [Nsensors(i) Ndipole]
                  If Gact = [], the iso-mode (no focal dipoles) is
                  executed.
 COV{Nsession}  : Noise covariance matrix
                   size(COV{i})   = [Nsensors(i) Nsensors(i)]

 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_check_variable(B, Cov, Gact, Gall)
0002 % Check variable consistency
0003 %  vb_check_varible(B, Cov, Gact, Gall)
0004 % -- Input
0005 % B{Nsession} : MEG magnetic field data matrix
0006 %                   size(B{i}) = [Nsensors(i), Tsample, Ntrials(i)]
0007 % Gall{Nsession}: Lead field for whole brain region as background activity
0008 %                   size(Gall{i}) = [Nsensors(i) Ndipole]
0009 %                  If Gall = [], the sparse-mode (focal dipoles only) is
0010 %                  executed.
0011 % Gact{Nsession} : Lead field (Current basis function)
0012 %                  for region with high estimation accuracy
0013 %                   size(Gact{i})  = [Nsensors(i) Ndipole]
0014 %                  If Gact = [], the iso-mode (no focal dipoles) is
0015 %                  executed.
0016 % COV{Nsession}  : Noise covariance matrix
0017 %                   size(COV{i})   = [Nsensors(i) Nsensors(i)]
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 fprintf('--- Check variable consistency')
0023 
0024 Nsession  = length(B);
0025 NsessionA = length(Gact);
0026 
0027 if Nsession ~= NsessionA,
0028     fprintf('\n Number of session in MEG = %d\n', Nsession)
0029     fprintf(' Number of session in LF  = %d\n', NsessionA)
0030     error('Number of session is different in MEG and Leadfield')
0031 end
0032 
0033 NsessionA = length(Gall);
0034 
0035 if Nsession ~= NsessionA,
0036     fprintf('\n Number of session in MEG = %d\n', Nsession)
0037     fprintf(' Number of session in LF  = %d\n', NsessionA)
0038     error('Number of session is different in MEG and Leadfield')
0039 end
0040 
0041 for n = 1 : Nsession
0042     % MEG data
0043     Nsensor = size(B{n},1);
0044     
0045     % Noise covariance
0046      [Nsensor1, Nsensor2] = size(Cov{n});
0047     
0048     if Nsensor ~= Nsensor1 | Nsensor ~= Nsensor2
0049         fprintf('\n Number of sensor in MEG = %d\n', Nsensor)
0050         fprintf(' Number of sensor in Cov = %d, %d\n', Nsensor1, Nsensor2)
0051         error('Number of sensor is different in MEG and Leadfield')
0052     end
0053 
0054     % LF for active region
0055      [NsensorG, Ndipole] = size(Gact{n});
0056      
0057     if Nsensor ~= NsensorG,
0058         fprintf('\n Number of sensor in MEG = %d\n', Nsensor)
0059         fprintf(' Number of sensor in LF  = %d\n', NsensorG)
0060         error('Number of sensor is different in MEG and Leadfield')
0061     end
0062      
0063     % LF for background region
0064      [NsensorG, Ndipole] = size(Gall{n});
0065      
0066     if Nsensor ~= NsensorG,
0067         fprintf('\n Number of sensor in MEG = %d\n', Nsensor)
0068         fprintf(' Number of sensor in LF  = %d\n', NsensorG)
0069         error('Number of sensor is different in MEG and Leadfield')
0070     end
0071 end
0072 
0073 fprintf(' is OK\n')

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