function Pjj = getcondP(P,m,n,jj,ii,y) % Pjj(x) = P{ X[jj]=x | X[ii]=y } if ~isempty(intersect(ii,jj)) error('ii and jj must not intersect'); end ljj = length(jj); dimi = repmat([m],[1 ljj]); Pjj = zeros(m^ljj,1); for xi = 1:m^ljj x = ind2coord(xi,dimi); Pjj(xi) = getPX(P,m,n,[y x],[ii jj]); end Pjj = Pjj / (sum(Pjj)+realmin); return