Creating spheres In Matlab that change surface color depending on data
4 次查看(过去 30 天)
显示 更早的评论
I am trying to create a series of randomly distributed spheres in Matlab, three will be three sub-sets. I would like each subset to have a different color. I am using a structure because each sphere will also have different properties associated with it. I tried using colormap, and set(...'FaceColor'..) but am having some difficulty. Please Help.
for n = 1:100
Bslice.cell(n).index = n;
Bslice.cell(n).type = 'Tyep1'; % Type2, Type3
Bslice.cell(n).location = round(rand(1, 3)*10);
end
[x,y,z] = sphere;
for n = 1:10
hold on
grid on
surfl(x-Bslice.cell(n).location(1), y-Bslice.cell(n).location(2), z- Bslice.cell(n).location(3))
shading interp
% colormap(hot(100))
end
1 个评论
Walter Roberson
2012-11-30
FaceColor and an RGB triple should work in theory; could you show an example of how you called it?
回答(0 个)
另请参阅
类别
在 Help Center 和 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!