필터 지우기
필터 지우기

Problem about specifying truecolor cData for a patch object

조회 수: 4 (최근 30일)
Niko
Niko 2013년 12월 16일
댓글: Walter Roberson 2013년 12월 18일
Hi all,
I'm having trouble with coloring a patch object using cData. My patch object is a triangulated polyhedron, so size(ZData)=[3,12]. When I'm trying to color each face with truecolor, I'm setting size(CData)=[1,12,3] because [1,12] is the dimension of all triangular faces of the polyhedron and 3 is for RGB. However, MATLAB seems to interpret it as colormap indices so I always end up having an ugly blue polyhedron. My guess is MATLAB is misinterpreting the color information because all faces of the patch have 3 vertices, which coincide with the 3 elements for RGB. Is there a way to force MATLAB to interpret cData as truecolor? Or, am I using a wrong dimension of cData for my purpose?
Thanks a lot!
Niko
  댓글 수: 3
Niko
Niko 2013년 12월 18일
편집: Niko 2013년 12월 18일
It's a 1*12*3 numeric array of doubles in the range of [0,1] (e.g. I tried cData=rand(1,12,3)). When I tried get(handle,'FaceColor') it returned a 12-element cell array with each element being a 1*3 numeric array. Does it mean that I should provide cData as a cell array? (It gives an error when I try transferring a cell array directly to facecolor.)
Walter Roberson
Walter Roberson 2013년 12월 18일
A 12-element cell array as a result suggests that your "handle" might be a vector of handles.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by