Home > reduc > flag > convertFlagToDataSize.m

convertFlagToDataSize

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function flags = convertFlagToDataSize(flag, NUMDIMS, noSwitch)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   function flags = convertFlagToDataSize(flag, NUMDIMS)

   function that converts our flag data (Nby3) to the size of the data and
   switch data register

   sjcm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function flags = convertFlagToDataSize(flag, NUMDIMS, noSwitch)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %   function flags = convertFlagToDataSize(flag, NUMDIMS)
0006 %
0007 %   function that converts our flag data (Nby3) to the size of the data and
0008 %   switch data register
0009 %
0010 %   sjcm
0011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0012 
0013 if(nargin<3)
0014   noSwitch = 0;
0015 end
0016 
0017 flags = flag;
0018 if(isfield(flag, 'fast'))
0019   if(~noSwitch)
0020     flags.switch = convSubFunc(flag.fast, 24);
0021   end
0022   flags.fast   = convSubFunc(flag.fast, NUMDIMS);
0023 end
0024 
0025 if(isfield(flag, 'bit'))
0026   if(~noSwitch)
0027     flags.bit.switch = convSubFunc(flag.bit.fast, 24);
0028   end
0029   flags.bit.fast   = convSubFunc(flag.bit.fast, NUMDIMS);
0030 end
0031 
0032 if(~isstruct(flag))
0033   flags = convSubFunc(flag, NUMDIMS);
0034 end
0035 
0036   
0037 
0038 return;
0039 
0040 
0041 
0042 function sizedFlags = convSubFunc(origFlag, NUMDIMS)
0043 
0044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0045 %
0046 %  function sizedFlags = cloneSubFunc(origFlag, USER, NUMDIMS)
0047 %
0048 %
0049 %   subfunction that gets all the flag data in the right size for the plots
0050 %
0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0052 
0053 switch NUMDIMS
0054   case 6
0055     thisFlag(:,1)   = origFlag(:,1);
0056     thisFlag(:,2:5) = repmat(origFlag(:,2), [1 4]);
0057     thisFlag(:,6)   = origFlag(:,3);
0058     
0059   case 8
0060     thisFlag(:,1)   = origFlag(:,1);
0061     thisFlag(:,2:7) = repmat(origFlag(:,2), [1 6]);
0062     thisFlag(:,8)   = origFlag(:,3);
0063     
0064   case 10
0065     thisFlag(:,1:2)  = repmat(origFlag(:,1), [1 2]);
0066     thisFlag(:,3:8)  = repmat(origFlag(:,2), [1 6]);
0067     thisFlag(:,9:10) = repmat(origFlag(:,3), [1 2]);
0068     
0069   case 24
0070     thisFlag(:,1:4)   = repmat(origFlag(:,1), [1 4]);
0071     thisFlag(:,5:20)  = repmat(origFlag(:,2), [1 16]);
0072     thisFlag(:,21:24) = repmat(origFlag(:,3), [1 4]);
0073     
0074 end
0075 
0076 sizedFlags = thisFlag;
0077 
0078 return;
0079

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005