Home > Mateda2.0 > otherfiles > NumconvertCard.m

NumconvertCard

PURPOSE ^

[valindex] = NumconvertCard(num,length,AccCard)

SYNOPSIS ^

function [valindex] = NumconvertCard(num,length,AccCard)

DESCRIPTION ^

 [valindex] = NumconvertCard(num,length,AccCard)
 NumconverCard:  Converts a vector of variables num, where the accumulative cardinality of each variable
                 is in AccCard, to the index valindex corresponding to the vector.
 INPUT:
 num: vector of values
 length: length of the vector
 AccCard: The product of cardinalities of previous  variables, 
          where the first variable is  the first one to the left.
 OUTPUT: 
 valindex: index of the vector in an ordering of all possible vectors

 Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [valindex] = NumconvertCard(num,length,AccCard)
0002 % [valindex] = NumconvertCard(num,length,AccCard)
0003 % NumconverCard:  Converts a vector of variables num, where the accumulative cardinality of each variable
0004 %                 is in AccCard, to the index valindex corresponding to the vector.
0005 % INPUT:
0006 % num: vector of values
0007 % length: length of the vector
0008 % AccCard: The product of cardinalities of previous  variables,
0009 %          where the first variable is  the first one to the left.
0010 % OUTPUT:
0011 % valindex: index of the vector in an ordering of all possible vectors
0012 %
0013 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0014 
0015    valindex = num(length);
0016      for i=1:length-1,
0017       valindex =  valindex +  num(i)*AccCard(i);
0018      end

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003