Home > vbmeg > functions > device > meg > preprocess > vb_actfile_combine_key.m

vb_actfile_combine_key

PURPOSE ^

Combine activities and register into activity file (.act.mat)

SYNOPSIS ^

function vb_actfile_combine_key(actfile,act_key1,act_key2,act_key3,mode)

DESCRIPTION ^

 Combine activities and register into activity file (.act.mat)

 --- Syntax
 function vb_actfile_combine_key(actfile,act_key1,act_key2,act_key3,mode)

 --- Input
 actfile : Activity file (.act.mat)
 act_key1: Activity map key to be combined
 act_key2: Activity map key to be combined
 act_key3: Activity map key for combined data

 --- Input (optional)
 mode: (default: 'max')
  mode = 'max': take maximal activity value at each vertex.
  mode = 'avr': take average of the two activity values at each vertex.

 --- Example
 >> actfile = 'sample.act.mat';
 >> act_key1 = 'act1';
 >> act_key2 = 'act2'; 
 >> act_key3 = 'act1_and_act2';
 >> vb_actfile_combine_key(actfile,act_key1,act_key2,act_key3);

 --- History
 2008-07-16 Taku Yoshioka
 2010-01-26 (Sako) renamed

 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_actfile_combine_key(actfile,act_key1,act_key2,act_key3,mode)
0002 % Combine activities and register into activity file (.act.mat)
0003 %
0004 % --- Syntax
0005 % function vb_actfile_combine_key(actfile,act_key1,act_key2,act_key3,mode)
0006 %
0007 % --- Input
0008 % actfile : Activity file (.act.mat)
0009 % act_key1: Activity map key to be combined
0010 % act_key2: Activity map key to be combined
0011 % act_key3: Activity map key for combined data
0012 %
0013 % --- Input (optional)
0014 % mode: (default: 'max')
0015 %  mode = 'max': take maximal activity value at each vertex.
0016 %  mode = 'avr': take average of the two activity values at each vertex.
0017 %
0018 % --- Example
0019 % >> actfile = 'sample.act.mat';
0020 % >> act_key1 = 'act1';
0021 % >> act_key2 = 'act2';
0022 % >> act_key3 = 'act1_and_act2';
0023 % >> vb_actfile_combine_key(actfile,act_key1,act_key2,act_key3);
0024 %
0025 % --- History
0026 % 2008-07-16 Taku Yoshioka
0027 % 2010-01-26 (Sako) renamed
0028 %
0029 % Copyright (C) 2011, ATR All Rights Reserved.
0030 % License : New BSD License(see VBMEG_LICENSE.txt)
0031 
0032 % Default parameters
0033 if nargin<5 || isempty(mode), mode = 'max'; end
0034 
0035 % Load activity maps
0036 act1 = vb_get_act(actfile,act_key1);
0037 act2 = vb_get_act(actfile,act_key2);
0038 
0039 % Combine data
0040 switch mode
0041  case 'max',
0042   act_new.xxP = (max([act1.xxP'; act2.xxP']))';
0043  case 'avr',
0044   act_new.xxP = (mean([act1.xxP'; act2.xxP']))';
0045 end
0046 
0047 act_new.key = act_key3;
0048 act_new.comment = ['This activity map was created from ' act_key1 ...
0049                    ' and ' act_key2 '.'];
0050 
0051 % Registration
0052 vb_add_act(actfile,act_new);
0053

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