MATLAB: How to fill a patch object with a pattern, such as diagonal lines or a texture map, in MATLAB R2020b

MATLAB

I would like to fill a patch object using the FILL function with a pattern rather than colors. For example, I would like to fill it with diagonal lines, a grid, texture map, or some other pattern.

Best Answer

The ability to fill a patch object with a pattern or texture mapping using the FILL function is not available in MATLAB R2020b.
To work around this issue, you can create a surface object using the SURF function rather than a PATCH object and apply a texturemap to the surface object. An example demonstrating how to do this using the surface CData and FaceColor properties is given in the following article:
Also, you may use the files at the following link at the MATLAB Central file exchange:
Note that MathWorks does not guarantee or warrant the use or content of these submissions. Any questions, issues, or complaints should be directed to the contributing author.