Home > reduc > plotting > cloneflag.m

cloneflag

PURPOSE ^

function [flag,autoflag,scriptflag]=cloneflag(flagBits)

SYNOPSIS ^

function [vflag,autoflag,scriptflag]=cloneflag(flagBits)

DESCRIPTION ^

 function [flag,autoflag,scriptflag]=cloneflag(flagBits)

 seperates user flags, auto flags, and script flags from visflag

 Stephen Muchovej

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [vflag,autoflag,scriptflag]=cloneflag(flagBits)
0002 
0003 % function [flag,autoflag,scriptflag]=cloneflag(flagBits)
0004 %
0005 % seperates user flags, auto flags, and script flags from visflag
0006 %
0007 % Stephen Muchovej
0008 
0009 
0010 USER   = bitshift(1,2);
0011 SCRIPT = bitshift(1,4);
0012 
0013 % user flags top priority
0014 for m=1:length(flagBits)
0015   vflag{m} = bitand(USER, flagBits{m});
0016 end
0017 
0018 % script flags second priority
0019 for m=1:length(flagBits)
0020   scriptflag{m} = bitand(SCRIPT, flagBits{m});
0021   scriptflag{m} = xor(vflag{m}, scriptflag{m});
0022 end
0023 
0024 % finally last but not least....
0025 for m=1:length(flagBits)
0026   autoflag{m} = flagBits{m};
0027   autoflag{m} = xor(autoflag{m}, scriptflag{m});
0028   autoflag{m} = xor(autoflag{m}, vflag{m});
0029 end
0030 
0031 return;
0032 
0033 
0034 function thisFlagBit = b_and(bit, flagBits)
0035 
0036 a = fieldnames(flagBits);
0037 for m=1:length(a)
0038   eval(sprintf('b.%s = bitand(bit, flagBits.%s);', a{m}, a{m}));
0039   eval(sprintf('b.%s = b.%s > 0;', a{m}, a{m}));  
0040 end
0041 
0042 thisFlagBit = b;
0043 
0044 return;
0045 
0046 function thisFlagBit = x_or(flag1, flag2)
0047 
0048 a = fieldnames(flag1);
0049 for m=1:length(a)
0050   eval(sprintf('b.%s = xor(flag1.%s, flag2.%s);', a{m}, a{m}, a{m}));
0051   eval(sprintf('b.%s = b.%s > 0;', a{m}, a{m}));  
0052 end
0053 
0054 thisFlagBit = b;
0055 
0056 return;

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