Unable to save file for Quiver

5 ビュー (過去 30 日間)
SC
SC 2019 年 4 月 19 日
回答済み: Walter Roberson 2019 年 4 月 19 日
Hi,
I have a quiver but I'm unable to save it by using imwrite? What should I do? (the function imwrite would be more preferable than the other function for saving).
Many thanks!
[x,y] = meshgrid(0:0.2:2,0:0.2:2);
u = cos(x).*y;
v = sin(x).*y;
figure
result=quiver(x,y,u,v);
imwrite(result, 'simpleresult.png');

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 4 月 19 日
You can never imwrite() a graphics object, including not even if it is an image.
Some kinds of graphics objects (such as images) you can pull out matrices of data that you can then (possibly process) and then imwrite(). You could pull out the XData and YData and UData and VData matrices from the quiver object and use tools from the Computer Vision Toolbox to recreate the quiver plot into an array. But that is a bunch of work.
What you probably want to do is use is getframe() the axes, and use frame2im() and then imwrite() the image that results.

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by