Trouble understanding Isocolors and CData usage.
이전 댓글 표시
Hello all,
I have a follow up question from a previous question I asked: So I have a [m n z] (3D) data set that gives me multiple spheres when rendered. I would like to color each individual sphere it's own unique color. After some research into matlab doc's, I came up trying to use 'isocolors'. It will uniformly change all the spheres but won't change each individual. I also understand that perhaps 'cdata' could perform this, but I'm a bit unclear how cdata works. When I try to use a map that is of the same dimensions [m n z] using 'CData', it gives me the following error:
Error using set
CData must be an M-by-N matrix or M-by-N-by-3 array.
So this confuses me about CData; Let's say I have 5 spheres that are created in the original [m n z] data; how do I set up a M-by-N matrix that will color each uniquely? Does it have to be 5x1 or 1x5 matrix?
Here's my code that renders the data in 3D (where 'XX' is my [m n z] data):
p=patch( isosurface(XX,0));
isonormals(XX,p)
isocolors(cdata,p)
set(p,'FaceColor','interp','EdgeColor','none')
daspect([1 1 .5])
view(3), axis vis3d tight, box on, grid off
camproj perspective
camlight, lighting phong, alpha(.5)
Any and all help would be much appreciated. Thank you!
Cheers, Edwin
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!