% Code of Edelman paper to generate table entries with % coloring modified to use whole numbers (no values 0.5) % and replacing Inf by values of 10 for commodity. % % INPUT: - % OUTPUT: qq: Matrix of value-coded table entries. % function [qq]=edelman % original code of Edelman paper: P=8*(-6:.125:6)'; q=0*P; for d=[1:(1/16) : 2-(1/16)] D = floor(16*d); Dp = D+1; % respect 5 different digit intervals qq=(P >= floor(-8*Dp/6)-1) + (P >= ceil(-5*D/6)) + ... (P >= floor(-4*Dp/6)-1) + (P >= ceil(-2*D/6)) + ... (P >= floor( -Dp/6)-1) + (P >= ceil( Dp/6)) + ... (P >= floor( 2*D/6)-1) + (P >= ceil( 4*Dp/6)) + ... (P >= floor( 5*D/6)-1) + (P >= ceil( 8*Dp/6)) ; q = [q qq]; end % shift q values to match digit values q=(q-5)/2; % set values outside range to Inf q(abs(q)==2.5) = Inf*q(abs(q)==2.5); % set 1st column (actually ignored in images) q(:,1)=P/8; % additional modifications: % get rid of 0.5 values by multiplying by two qq=floor(q*2); % replace Inf with value 10, count all cells to be colored [m,n]=size(q);z=0; for i=1:m for j=1:n if qq(i,j)==Inf qq(i,j)=10; end if qq(i,j)==-Inf qq(i,j)=-10; end if j>1 && abs(qq(i,j))<9 z=z+1; end end end disp(['number of cells to be colored: ', num2str(z)]) return