how do use patch in the background?

17 次查看(过去 30 天)
Liang Zhan
Liang Zhan 2011-4-8
I know matlab has patch function, which is patch(X,Y,Z,C) creates a patch in 3-D coordinates. If the coordinate data does not define closed polygons, patch closes the polygons. The data can define concave or intersecting polygons. However, if the edges of an individual patch face intersect themselves, the resulting face might be only partly filled. In that case, it is better to divide the face into smaller polygons.
I can use it to plot my figure normally, but the question is I need to do this work in the background (something like use patch to plot the figure(no display), then save the figure as jpg or eps in the background, then only display the jpg or eps.)
can anyone help me? Thanks,
LZ

回答(1 个)

Liang Zhan
Liang Zhan 2011-4-8
I run the code in unix background, and the main code is:
h=figure('Visible','off');
for i=1:256
for j=1:256
patch(XX, YY, ZZ,C,'LineStyle', 'none');
end
end
saveas(h,'figure_test_no_display.jpg');
then it come out a very long error message, which I can not post here.
  14 个评论
Liang Zhan
Liang Zhan 2011-4-8
Wow~, it works very well, thanks a lot for your suggestion. It solved me a big problem, appreciate!!!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by