Home > vbmeg > functions > common > container > vb_rm_act.m

vb_rm_act

PURPOSE ^

This function is used to remove cortical activity data.

SYNOPSIS ^

function vb_rm_act(actfile,act_key,flag)

DESCRIPTION ^

 This function is used to remove cortical activity data. 

 --- Syntax
 vb_rm_act(actfile,act_key,flag)

 --- Input
 actfile: Cortical activity file (.act.mat)
 act_key: ID of area information to be removed

 --- Optional input
 - flag  : If OFF, confirmation dialog will be suppressed. 

 --- Output

 --- Example
 >> actfile = './TY/data/TY.act.mat';
 >> act_key = 'tmp';
 >> vb_rm_act(actfile,act_key);

 --- History
 2004-12-27 Taku Yoshioka
 2006-08-11 Taku Yoshioka (dialog suppression flag)

 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_rm_act(actfile,act_key,flag)
0002 % This function is used to remove cortical activity data.
0003 %
0004 % --- Syntax
0005 % vb_rm_act(actfile,act_key,flag)
0006 %
0007 % --- Input
0008 % actfile: Cortical activity file (.act.mat)
0009 % act_key: ID of area information to be removed
0010 %
0011 % --- Optional input
0012 % - flag  : If OFF, confirmation dialog will be suppressed.
0013 %
0014 % --- Output
0015 %
0016 % --- Example
0017 % >> actfile = './TY/data/TY.act.mat';
0018 % >> act_key = 'tmp';
0019 % >> vb_rm_act(actfile,act_key);
0020 %
0021 % --- History
0022 % 2004-12-27 Taku Yoshioka
0023 % 2006-08-11 Taku Yoshioka (dialog suppression flag)
0024 %
0025 % Copyright (C) 2011, ATR All Rights Reserved.
0026 % License : New BSD License(see VBMEG_LICENSE.txt)
0027 
0028 if nargin<3, flag=ON; end
0029 
0030 if exist(actfile) == 2
0031   load(actfile);
0032   % Support for old version
0033   if ~exist('MRI_ID'), 
0034     MRI_ID = '0000000';
0035     disp(['--- Activity map file ' actfile ' is a old version, ' ...
0036       'in which variable ''MRI_ID'' is not saved. A tentative ' ...
0037       'ID ''0000000'' was automatically assigned to the activity' ...
0038       ' map file.']);
0039   end
0040 else
0041   disp('Activity map file is not found.');
0042   return;
0043 end
0044 
0045 for i = 1:length(Act)
0046   if strcmp(act_key,Act{i}.key)
0047     ActNew = cell(length(Act)-1,1);
0048     for j = 1:i-1
0049       ActNew{j} = Act{j};
0050     end
0051     for j = i+1:length(Act)
0052       ActNew{j-1} = Act{j};
0053     end
0054     Act = ActNew;
0055     vb_fsave(actfile,'Act','MRI_ID');
0056     if flag, 
0057       h = msgbox(['Activity map ''' act_key ''' was removed.']);
0058       uiwait(h);
0059     end
0060     return;
0061   end
0062 end
0063 
0064 error(['Activity map ''' act_key ''' is not found.']);

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