Here is part of my code.
% +----------------------------+ %
% |---- Model Body ----| %
% +-----------------------------+ %
[xbodyP,ybodyP,zbodyP] = ellipsoid(-0.03,0,0,0.07,0.02,0.02,100);
[xheadP,yheadP,zheadP] = ellipsoid(0.035,0,0,0.015,0.015,0.015,100);
h1 = surfl(xbodyP,ybodyP,zbodyP);
h2 = surfl(xheadP,yheadP,zheadP);
shading interp
colormap([.5 .5 .5]);
%set(h1, 'FaceColor','ColorSpec','[.2 .6 .5]')
%set(h2,'Color','Gray')
The commented out part was my attempt to specify the color for each surface.
Once I say colormap every surface takes that color. But if I comment that out and try to specify it with set( then it gives me errors or doesnt work at all.
Am I using handles incorrectly? Or is there a better way?
Thanks for the help
Someone from the university mentioned using patches, but I have not worked with them so I am not sure if that would help or not.
I'm not exactly sure what you are trying to do.
But if the above is your actual code, you are
simply overwriting the plot of h1 with h2.
If you want both plots to appear in the same figure
I think you need to insert a
hold on
statement between the two surfl commands.
There is actually a plot before all this were I added hold on. This is just one chunk of my code.
I am actually trying to model a bat in matlab. I read in some data files that contain wind tunnel position information and then I plot the trajectories of its limbs. Now I am trying to animate it so that it can be used for presentations. Right now though it looks really childish, so I am trying to change some surface colors, and fix the bat ears, etc. Which I will have questions for those parts as well, but at the moment I cannot figure out how to change the colors.
Thanks for the reply.
Find yourself the colormap values (just a pedestrian interpolation) and then plot the surfaces with Cdata
SURF(X,Y,Z,C)