Home > database > legacy > ensemble_make_sub_masks.m

ensemble_make_sub_masks

PURPOSE ^

[sub_mask_mtx, subids] = ensemble_make_sub_masks(subid_vect);

SYNOPSIS ^

function [sub_mask_mtx, subids] = ensemble_make_sub_masks(subid_vect)

DESCRIPTION ^

 [sub_mask_mtx, subids] = ensemble_make_sub_masks(subid_vect);

 Given a vector of subject IDs, a matrix (sub_mask_mtx) is returned in which each
 column contains a logical value indicating the locations within subid_vect that
 correspond to that subject.  The list of subjects is returned in subids, as
 ordered by unique.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [sub_mask_mtx, subids] = ensemble_make_sub_masks(subid_vect)
0002 % [sub_mask_mtx, subids] = ensemble_make_sub_masks(subid_vect);
0003 %
0004 % Given a vector of subject IDs, a matrix (sub_mask_mtx) is returned in which each
0005 % column contains a logical value indicating the locations within subid_vect that
0006 % correspond to that subject.  The list of subjects is returned in subids, as
0007 % ordered by unique.
0008 %
0009 
0010 % 02/01/07 Petr Janata
0011 
0012 subids = unique(subid_vect);
0013 nsub = length(subids);
0014 sub_mask_mtx = false(size(subid_vect,1),nsub);
0015 
0016 fprintf('Calculating subject masks for %d subjects\n', nsub);
0017 for isub = 1:nsub
0018   fprintf('.')
0019   sub_mask_mtx(:,isub) = ismember(subid_vect, subids(isub));
0020 end
0021 fprintf('\n');

Generated on Sun 19-May-2019 04:00:51 by m2html © 2003