How to preset frame size with Videowriter?

16 views (last 30 days)
I am using getframe and videowriter functions in my code. I know that the frame size of the first frame will set the size for every other frame. Because of this fact (if i am not mistaken) I am getting the following error.
Error using VideoWriter/writeVideo (line 356)
Frame must be 545 by 672
I would like to know if there is a way to overcome this problem. Does presetting the frame size solves it? And if it does how can I do it? Is there another solution?
Thanks in advance!
  1 Comment
Ameer Hamza
Ameer Hamza on 19 Oct 2020
Can you show how you are getting the frames from your figure? If your axes is changing its size and use are use getfame(gca), then you will have this issue.

Sign in to comment.

Answers (1)

Ameer Hamza
Ameer Hamza on 19 Oct 2020
In your code, try to apply getframe on figure instead of axes
getframe(gcf);
otherwise fix the axis limits
ax = gca;
ax.XLimMode = 'manual';
ax.YLimMode = 'manual'
ax.ZLimMode = 'manual'

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!