Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:42:42+00:00 2026-05-27T21:42:42+00:00

I attempt to create a movie by looping through frames in MATLAB. Refering to

  • 0

I attempt to create a movie by looping through frames in MATLAB.

Refering to mathworks.com documentation at http://www.mathworks.com/help/techdoc/ref/movie.html, I’ve managed to animate a plot. However, issues arise when I attempt to save the movie in an avi file.

Both the avifile and VideoWriter methods from https://stackoverflow.com/a/8038540/818608, resulted in the same errors.

Although the animation runs fine, the saved movie consists of only one fixed frame, and at times, the screen capture includes an overlay of my background web browser.

Thank you in advance.

Below is the code I used, and the frame that’s frozen on the avi is linked below.

Z = peaks; surf(Z); 
axis tight
set(gca,'nextplot','replacechildren');

vid = VideoWriter('myPeaks2.avi');
vid.Quality = 100;
vid.FrameRate = 15;
open(vid);
for k = 1:20 
    surf(sin(2*pi*k/20)*Z,Z)
    writeVideo(vid, getframe(gcf));
end
close(vid);

winopen('myPeaks2.avi')

The frame that's frozen on the avi is linked below

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:42:43+00:00Added an answer on May 27, 2026 at 9:42 pm

    Try the following:

        f = figure();
        Z = peaks; surf(Z);
        a = axes('Parent',f);
        axis(a,'tight');
        set(a,'nextplot','replacechildren');
        vid = VideoWriter('myPeaks2.avi');
        vid.Quality = 100;
        vid.FrameRate = 15;
        open(vid);
        for k = 1:20
            surf(a,sin(2*pi*k/20)*Z,Z)
            writeVideo(vid, getframe(f));
        end
        close(vid);
    
        winopen('myPeaks2.avi')
    

    It contains explicit handles using instead of implicit. Many chaos is caused in Matlab because people tend to use the implicit ones, like “gcf”, “gca” which should have been removed completely from the language, IMHO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found only one attempt to create such compiler - http://sourceforge.net/projects/xsltc/ . But this
I'm after a simple stored procedure to drop tables. Here's my first attempt: CREATE
Continuing on my attempt to create a DateTime class , I am trying to
I've decided to take the advice in this question: create-excel-chart-programmatically-in-php and NOT attempt to
In an attempt to create cleaner code, I am trying to write event handler
When I attempt to create a new flash list component from my as3 file
The following code snippet attempts to create a Tib DaemonManager connecting to a particular
I've created the following regex pattern in an attempt to match a string 6
My attempts to query MySQL from PHP with a create statement of a store
First attempt to use this cool site - after searching for 2 hours: So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.