function display_number_neighbors(V,E,C,bdry_cells) % Displays the different cells with the colors indicating the number of % sides(neighbors) of each cell. % %For bugs, comments, etc. please contact Kapil Krishan : %kkrishan@uci.edu %www.physics.uci.edu/~foams %version: I hold on; for ic=1:size(E,1) line([V(E(ic,1),1) V(E(ic,2),1)],[V(E(ic,1),2) V(E(ic,2),2)],'color',[0 0 0]); end; cmp=[1 1 1;1 1 1; 0 1 1;0 0.5 0; 1 1 0;0.8 0.8 0.8; 0 1 1; 1 0.5 0.2; 0.2 0.5 0.5; 1 0 0;0 0 1]; colormap(cmp); hold on; for i = 1:length(C) if all(C{i}~=1) % If at least one of the indices is 1, % then it is an open region and we can't % patch that. patch(V(C{i},1),V(C{i},2),size(C{i},2),'CDataMapping','direct'); % use color '# of sides' end end for i=bdry_cells' if all(C{i}~=1) patch(V(C{i},1),V(C{i},2),1,'CDataMapping','direct'); % use color bdry. end end axis equal;axis([1 max(V(E,1)) 1 max(V(E,2))]);axis ij;drawnow;