You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: extract_measures_batch.m
    path of file: ./repos/CanlabCore/CanlabCore/@fmri_data
    
    the code of the file until where you have to start completion: function DAT = extract_measures_batch(data_obj)
% Extracts a set of measures relevant for pattern-based and network-based analyses
%
% DAT = extract_measures_batch(data_obj)
% 
% This is a method called extract_measures_batch for fmri_objects.  
% It Extracts a set of measures relevant for pattern-based and network-based analyses. 
% The idea is to aggregate these across studies, and pull relevant measures from the set 
% for particular analyses.  It returns the following structure:
%
% Tor Wager, August 2018
%
% 
% DAT = 
% 
%   struct with fields:
% 
%        extracted_on_date: '05-Sep-2018_02_49? 	Date information was extracted
%              image_names: 'wrrest_mb8_r1.nii? 	Original image names (no paths)
%                 fullpath: [914×119 char]          Full path names for all volumes (for provenance)
%              mahalanobis: [914×5 table]           Mahalanobis distances (for weighting/nuisance)and outlier ID logical
%                    rmssd: [1×1 struct] 			Root mean square successive differences and outlier ID logical
%     gray_white_csf_table: [914×5 table]           Global avg gray, white, CSF, and 5 principal components	 for each; for nuisance
%                  npsplus: [1×1 struct] 			Multivariate pattern responses for CANlab measures (NPS, more)
%            kragelemotion: [1×1 struct]            Multivariate pattern responses for Kragel 2015 emotion classification
%                 kragel18: [1×1 struct] 			Multivariate PLS pattern responses for Kragel 2018 Nat Neurosci and subregions
%                 pain_pdm: [1×1 struct] 			Multivariate pattern responses for Geuter et al.?s Prin. Dirs of Medation (10 patterns, and combined)
%                  PARCELS: [1×1 struct] 			Parcellations: Averages for each parcel, and local pattern responses (selected)
%
% Tables:
% Some variables are in Matlab table objects, e.g., DAT.mahalanobis. 
% 
% Access names like this:
% DAT.mahalanobis.Properties.VariableNames
% See methods(table) for more operations.  table2array() is useful for extracting data matrices.
% outliers = DAT.mahalanobis.wh_outlier_uncorr;  % returns a logical vector of outlier images id'd as having high Mahalanobis distances
%
% OUTLIERS
% To get a reasonable set of outlier image indicators (indicator vector):
% outliers = DAT.mahalanobis.wh_outlier_uncorr | DAT.rmssd.wh_outliers_rmssd;  % returns a logical vector of outlier images id'd as having high Mahalanobis distances
%
% EXTRACTED GLOBAL TISSUE COMPARTMENTS
% DAT.gray_white_csf_table.Properties.VariableNames
% 
% {'gwcsf'       }      % n_images x 3, global mean gray, white, CSF (assumes MNI space; group template)
% {'gray5'       }      % n_images x 5, first 5 principal components across gray matter
% {'white5'      }      % n_images x 5, first 5 principal components across white matter
% {'csf5'        }      % n_images x 5, first 5 principal components across CSF
% {'gwcsf_l2norm'}      % n_images x 3, L2 norms for each image x [gray white CSF]
%
% 
% NUISANCE COVARIATES:
% -------------------------------------------------------------------------
% Here is a reasonable set of nuisance covariates. If you are contenating
% across runs (when scaner starts and stops), add indicator vectors for
% run, plus movement covariates (e.g., 24 per run, not included.)
%

    
function DAT = extract_measures_batch(data_obj)
% Extracts a set of measures relevant for pattern-based and network-based analyses
%
% DAT = extract_measures_batch(data_obj)
% 
% This is a method called extract_measures_batch for fmri_objects.  
% It Extracts a set of measures relevant for pattern-based and network-based analyses. 
% The idea is to aggregate these across studies, and pull relevant measures from the set 
% for particular analyses.  It returns the following structure:
%
% Tor Wager, August 2018
%
% 
% DAT = 
% 
%   struct with fields:
% 
%        extracted_on_date: '05-Sep-2018_02_49? 	Date information was extracted
%              image_names: 'wrrest_mb8_r1.nii? 	Original image names (no paths)
%                 fullpath: [914×119 char]          Full path names for all volumes (for provenance)
%              mahalanobis: [914×5 table]           Mahalanobis distances (for weighting/nuisance)and outlier ID logical
%                    rmssd: [1×1 struct] 			Root mean square successive differences and outlier ID logical
%     gray_white_csf_table: [914×5 table]           Global avg gray, white, CSF, and 5 principal components	 for each; for nuisance
%                  npsplus: [1×1 struct] 			Multivariate pattern responses for CANlab measures (NPS, more)
%            kragelemotion: [1×1 struct]            Multivariate pattern responses for Kragel 2015 emotion classification
%                 kragel18: [1×1 struct] 			Multivariate PLS pattern responses for Kragel 2018 Nat Neurosci and subregions
%                 pain_pdm: [1×1 struct] 			Multivariate pattern responses for Geuter et al.?s Prin. Dirs of Medation (10 patterns, and combined)
%                  PARCELS: [1×1 struct] 			Parcellations: Averages for each parcel, and local pattern responses (selected)
%
% Tables:
% Some variables are in Matlab table objects, e.g., DAT.mahalanobis. 
% 
% Access names like this:
% DAT.mahalanobis.Properties.VariableNames
% See methods(table) for more operations.  table2array() is useful for extracting data matrices.
% outliers = DAT.mahalanobis.wh_outlier_uncorr;  % returns a logical vector of outlier images id'd as having high Mahalanobis distances
%
% OUTLIERS
% To get a reasonable set of outlier image indicators (indicator vector):
% outliers = DAT.mahalanobis.wh_outlier_uncorr | DAT.rmssd.wh_outliers_rmssd;  % returns a logical vector of outlier images id'd as having high Mahalanobis distances
%
% EXTRACTED GLOBAL TISSUE COMPARTMENTS
% DAT.gray_white_csf_table.Properties.VariableNames
% 
% {'gwcsf'       }      % n_images x 3, global mean gray, white, CSF (assumes MNI space; group template)
% {'gray5'       }      % n_images x 5, first 5 principal components across gray matter
% {'white5'      }      % n_images x 5, first 5 principal components across white matter
% {'csf5'        }      % n_images x 5, first 5 principal components across CSF
% {'gwcsf_l2norm'}      % n_images x 3, L2 norms for each image x [gray white CSF]
%
% 
% NUISANCE COVARIATES:
% -------------------------------------------------------------------------
% Here is a reasonable set of nuisance covariates. If you are contenating
% across runs (when scaner starts and stops), add indicator vectors for
% run, plus movement covariates (e.g., 24 per run, not included.)
%
% First, turn outlier vector into a set of separate  dummy regressors for each outlier point
% outliers = DAT.mahalanobis.wh_outlier_uncorr | DAT.rmssd.wh_outliers_rmssd;  % returns a logical vector of outlier images id'd as having high Mahalanobis distances
% outliers = double(outliers);
% outliers(outliers > 0) = find(outliers);
% [outlier_indic, outlier_levels] = condf2indic(outliers);
% outlier_indic(:, outlier_levels == 0) = [];
% outlier_names = {};
% for i = 1:size(outlier_indic, 2)
%     outlier_names{i} = sprintf('Spike%3.0f', i);
% end