Home > GVSToolbox > findVarForBestIdx.m

findVarForBestIdx

PURPOSE ^

This function tells you which variables are best in an easy to understand format

SYNOPSIS ^

function findVarForBestIdx( varParams, bestIdx )

DESCRIPTION ^

 This function tells you which variables are best in an easy to understand format
 Samuel Rivera
 Jul 20, 2011
 syntax: findVarForBestIdx( varParams, bestIdx )
 
 Inputs:
 varParams: the struct returnd by extractVarsDist ( when you extracted
   variables)
 bestIdx: a vector of the best indices as determined by the sortVariable**
   functions.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % This function tells you which variables are best in an easy to understand format
0002 % Samuel Rivera
0003 % Jul 20, 2011
0004 % syntax: findVarForBestIdx( varParams, bestIdx )
0005 %
0006 % Inputs:
0007 % varParams: the struct returnd by extractVarsDist ( when you extracted
0008 %   variables)
0009 % bestIdx: a vector of the best indices as determined by the sortVariable**
0010 %   functions.
0011 %
0012 function findVarForBestIdx( varParams, bestIdx )
0013 
0014 
0015 
0016 numAOIs = varParams.dimPerFeat(1);  % var 1 is AOI fix density
0017 % % numRelAOIs = varParams.dimPerFeat(5)/varParams.numHistBins;% var 5 is hist bins
0018 % % numBins = varParams.numHistBins;
0019 
0020 clear x whereItIs
0021 numBest = length( bestIdx );
0022 numVariableTypes = length( varParams.dimPerFeat);
0023 
0024 for i1 = 1:numVariableTypes
0025     x(i1) = sum(varParams.dimPerFeat(1:i1));
0026 end
0027 
0028 whereItIs = zeros( numBest,1);
0029 for i1 = 1:numBest
0030     temp = find( bestIdx(i1) <= x );
0031     whereItIs(i1) = temp(1);
0032 end
0033 
0034 for i1 = 1:numBest    
0035     % find exact variable within the variable type ( ie, 2nd fixation density)
0036     if whereItIs(i1) > 1
0037         subWhereItIs(i1) = bestIdx(i1) - x( whereItIs(i1) -1);
0038     else
0039         subWhereItIs(i1) = bestIdx(i1);
0040     end   
0041     
0042     
0043 %     i1
0044 %     subWhereItIs(i1)
0045     
0046     %output very nicely which variable
0047     if strcmp( varParams.dimNames{whereItIs(i1)}, 'AOIFixationSeq' ) %fixation sequence
0048         whichPos = mod( subWhereItIs(i1), numAOIs);
0049         if whichPos == 0; whichPos =numAOIs; end
0050         whichFix = ceil( subWhereItIs(i1)/numAOIs );
0051         fprintf( 'Var %d is Fix %d at AOI %d \n', i1, whichFix, whichPos);    
0052     
0053     elseif strcmp( varParams.dimNames{whereItIs(i1)}, 'AOISaccadeSeq' )
0054         whichPos = mod( subWhereItIs(i1), numAOIs);
0055         if whichPos == 0; whichPos =numAOIs; end
0056         whichFix = ceil( subWhereItIs(i1)/numAOIs );
0057         fprintf( 'Var %d is Sac %d to AOI %d \n', i1, whichFix, whichPos);      
0058         
0059 % %    elseif strcmp( varParams.dimNames{whereItIs(i1)}, 'AOIFixationDistHistogram' )
0060 % %         whichPos = mod( subWhereItIs(i1), numBins);
0061 % %         if whichPos == 0; whichPos =numBins; end
0062 % %         whichAOI = ceil( subWhereItIs(i1)/numBins );
0063 % %         fprintf( 'Var %d is rel AOI %d, DHB %d \n', i1, whichAOI, whichPos);
0064 % %
0065         
0066     elseif strcmp( varParams.dimNames{whereItIs(i1)}, 'relNonRelFixSeq' )  
0067         target = 'relevant';
0068         whichPos = mod( subWhereItIs(i1), 2);
0069         if whichPos == 0; target = 'non-relevant'; end
0070         whichFix = ceil( subWhereItIs(i1)/2 );
0071         fprintf( 'Var %d is Fix %d at %s AOI \n', i1, whichFix, target);          
0072  
0073                 
0074     elseif strcmp( varParams.dimNames{whereItIs(i1)}, 'relNonRelSacSeq' )  
0075         target = 'relevant';
0076         whichPos = mod( subWhereItIs(i1), 2);
0077         if whichPos == 0; target = 'non-relevant'; end
0078         whichFix = ceil( subWhereItIs(i1)/2 );
0079         fprintf( 'Var %d is Sac %d to %s AOI \n', i1, whichFix, target);     
0080         
0081     else % default output
0082         fprintf( 'Var %d is var %d of %s\n', i1, subWhereItIs(i1), ...
0083                 varParams.dimNames{whereItIs(i1)});        
0084     end
0085     
0086 end
0087 
0088 
0089 
0090 
0091

Generated on Tue 01-Jul-2014 12:35:04 by m2html © 2005