Home > bml > annot > bml_annot_conform_to.m

bml_annot_conform_to

PURPOSE ^

BML_ANNOT_CONFORM_TO conforms an annotation table to the shape of an other

SYNOPSIS ^

function conformed = bml_annot_conform_to(template, annot)

DESCRIPTION ^

 BML_ANNOT_CONFORM_TO conforms an annotation table to the shape of an other

 template - annot table to use as template for transformation
 annot - annot table to conform

 returns a conformed annot table

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function conformed = bml_annot_conform_to(template, annot)
0002 
0003 % BML_ANNOT_CONFORM_TO conforms an annotation table to the shape of an other
0004 %
0005 % template - annot table to use as template for transformation
0006 % annot - annot table to conform
0007 %
0008 % returns a conformed annot table
0009 
0010 template_vars = template.Properties.VariableNames;
0011 annot_vars = annot.Properties.VariableNames;
0012 
0013 missing_vars = setdiff(template_vars,annot_vars);
0014 for i=1:length(missing_vars)
0015   if iscellstr(template.(missing_vars{i}))
0016     annot.(missing_vars{i}) = repmat({''},height(annot),1);
0017   elseif iscell(template.(missing_vars{i}))
0018     annot.(missing_vars{i}) = repmat({nan},height(annot),1);
0019   else
0020     annot.(missing_vars{i}) = NaN(height(annot),1); 
0021   end
0022 end
0023 
0024 conformed = annot(:,template_vars);
0025 
0026 
0027 
0028

Generated on Tue 25-Sep-2018 10:08:19 by m2html © 2005