How to set Color Data for Interpolated shading?

3 views (last 30 days)
I wrote a function to visualize some values on an object made of 24 brick elements:
function plottings(quantity)
load('Mesh.mat', 'nds','elms')
load('Specifications.mat','ELEMENT')
x=nds(:,1);
y=nds(:,2);
z=nds(:,3);
vertex_matrix =[x y z];
faces_matrix=[];
for i=1:ELEMENT
face = [elms(i,1) elms(i,2) elms(i,6) elms(i,5);
elms(i,2) elms(i,3) elms(i,7) elms(i,6);
elms(i,3) elms(i,4) elms(i,8) elms(i,7);
elms(i,4) elms(i,1) elms(i,5) elms(i,8);
elms(i,1) elms(i,2) elms(i,3) elms(i,4);
elms(i,5) elms(i,6) elms(i,7) elms(i,8)];
faces_matrix= vertcat(faces_matrix,face);
end
FaceVertexCData=quantity;
patch('Vertices',vertex_matrix,'Faces',faces_matrix,...
'FaceVertexCData',hsv(8),'FaceColor','interp')
view(3)
axis equal
end
...but Matlab doesn't want to interpolate shading and writes: Warning: Color Data is not set for Interpolated shading How should I write the code to pass that warning? or...what should I use instead of patch()?

Accepted Answer

Julius
Julius on 23 Jun 2012
fill3() works perfectly

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!