Patch error on m_plots
显示 更早的评论
In a for loop, I am plotting frames of a GIF. There are two subplots, two 'm_pcolor', one 'm_quiver'. These are from the m_map toolbox. I am using the following code to get the GIF made: (If I comment this, the error still remains)
drawnow
filename = 'testnew.gif';
frame = getframe(1);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if time_loop == 1
imwrite(imind,cm,filename,'gif','Loopcount',inf);
else
imwrite(imind,cm,filename,'gif','WriteMode','append');
end
The error I get for every loop is:
Warning: Error creating or updating Patch
Error in value of property FaceVertexCData
Number of colors must equal number of vertices
If I remove the for loop and run the code inside the loop on its own, everything works fine. Everything plots OK, but seems slower with the error.
What does the error mean? Is there any solution?
1 个评论
Walter Roberson
2019-2-28
Is the error showing up at the drawnow() ? Is it showing up at the getframe() call?
It looks like you are hard-coding fetching frames from figure #1, using old style figure numbers (that does still work even in the latest releases, by the way.)
Is it correct that you have a patch() object in your figure?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!