First you need to change FaceColor
to 'flat'
to enable colours to be read from a color-data array - the CData
property:
Try this (not tested though):
p = patch( ...
'Faces', faces, ...
'Vertices', verts, ...
'FaceColor', 'flat', ...
'CData', strain' ...
);
Here I set the CData
property to the transpose of your strain
vector. MATLAB should then automatically map the N strain-values in this vector to the chosen colormap (linearly). See property CDataMapping
for more information:
Documentation:
http://www.mathworks.se/help/matlab/ref/patch_props.html#FaceColor http://www.mathworks.se/help/matlab/ref/patch_props.html#CData http://www.mathworks.se/help/matlab/ref/patch_props.html#CDataMapping