


[num] = IndexconvertCard(valindex,length,AccCard)
IndexconvertCard: Converts the index valindex to the vector of variables num,
INPUT:
valindex: index of the vector in an ordering of all possible vectors
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:
num: vector of values
Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

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