MATLAB: Structure mesh: plot different regions with different colors

mesh

Hi all,
I have a 2D mesh with different regions, like this:
I generated a mesh for this beam
Is there a way to highlight the 2 circles with different colors?
Many thanks!

Best Answer

load data.mat ;
tri = data.elem ;
coor = data.node ;
x = coor(:,1) ; y = coor(:,2) ; z = coor(:,3) ;
patch('faces',tri(:,2:4),'vertices',coor , ...
'facevertexcdata' , z, ...
'facecolor','interp', ...
'edgecolor','none') ;
hold on
c1 = data.region1 ;
c2 = data.region2 ;
patch(c1(:,1),c1(:,2),c1(:,3),'r')
patch(c2(:,1),c2(:,2),c2(:,3),'b')