VideoRecord property

Class: Aero.Animation
Package: Aero

Video recording

Values

‘on’

Enable video recording.

‘off’

Disable video recording.

‘scheduled’

Schedule video recording. Use this setting with the VideoTStart and VideoTFinal properties.

Data type: character vector | string

Default: 'off'

Description

This property enables video recording of animation objects.

If you are capturing frames of a plot that takes a long time to generate or are repeatedly capturing frames in a loop, make sure that your computer's screen saver does not activate and that your monitor does not turn off for the duration of the capture; otherwise one or more of the captured frames can contain graphics from your screen saver or nothing at all.

Note

In situations where MATLAB® software is running on a virtual desktop that is not currently visible on your monitor, it may capture a region on your monitor that corresponds to the position occupied by the figure or axes on the hidden desktop. Therefore, make sure that the window to be captured exists on the currently active desktop.

Examples

expand all

Simulate and record flight data. Create an animation object.

h = Aero.Animation;

Control the frame display rate.

h.FramesPerSecond = 10;

Set the time-scaling (TimeScaling) property on the animation object to specify the data per second.

h.TimeScaling = 5;

The combination of FramesPerSecond and TimeScaling properties determines the time step of the simulation. These settings result in a time step of approximately 0.5 s.

Create and load a body for the animation object.

idx1 = h.createBody('pa24-250_orange.ac','Ac3d');

Load simulated flight trajectory data (simdata), located in matlabroot\toolbox\aero\astdemos.

load simdata;

Set the time series data for the body.

h.Bodies{1}.TimeSeriesSource = simdata;

Create a figure object for the animation object.

h.show();

Set up recording properties.

h.VideoRecord = 'on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI'
h = 
  Animation with properties:

                      Name: ''
                    Figure: [1×1 Figure]
    FigureCustomizationFcn: []
                    Bodies: {[1×1 Aero.Body]}
                    Camera: [1×1 Aero.Camera]
               TimeScaling: 5
                    TStart: NaN
                    TFinal: NaN
                  TCurrent: 0
           FramesPerSecond: 10
               VideoRecord: 'on'
             VideoFileName: 'temp'
          VideoCompression: 'Motion JPEG AVI'
              VideoQuality: 50
               VideoTStart: NaN
               VideoTFinal: NaN

h.VideoFilename = 'astMotion_JPEG';

Play the animation.

h.play();

Verify that a file named astMotion_JPEG.avi was created in the current folder.

Disable recording to preserve the file.

h.VideoRecord = 'off';

Simulate flight data for four seconds. Create an animation object.

h = Aero.Animation;

Control the frame display rate.

h.FramesPerSecond = 10;

Configure the animation object to set the seconds of animation data per second time-scaling (TimeScaling) property.

h.TimeScaling = 5;

The combination of FramesPerSecond and TimeScaling properties determines the time step of the simulation (TimeScaling/|FramesPerSecond|). These settings result in a time step of approximately 0.5 s.

Create and load a body for the animation object.

idx1 = h.createBody('pa24-250_orange.ac','Ac3d');

Load simulated flight trajectory data (simdata), located in matlabroot\toolbox\aero\astdemos.

load simdata;

Set the time series data for the body.

h.Bodies{1}.TimeSeriesSource = simdata;

Create a figure object for the animation object.

h.show();

Set up recording properties.

h.VideoRecord='on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI';
h.VideoFilename = 'astMotion_JPEG';

Play the animation from TFinal to TStart.

h.TSTart = 1;
h.TFinal = 5;
h.play();

Verify that a file named astMotion_JPEG.avi was created in the current folder. When you rerun the recording, notice that the play time is shorter than that in the previous example when you record for the length of the simulation time.

Disable recording to preserve the file.

h.VideoRecord = 'off';

Schedule three second recording of animation object simulation.

Create an animation object.

h = Aero.Animation;

Control the frame display rate.

h.FramesPerSecond = 10;

Configure the animation object to set the seconds of animation data per second time-scaling (TimeScaling) property.

h.TimeScaling = 5;

The combination of FramesPerSecond and TimeScaling properties determines the time step of the simulation (TimeScaling/|FramesPerSecond|). These settings result in a time step of approximately 0.5 s.

Create and load a body for the animation object.

idx1 = h.createBody('pa24-250_orange.ac','Ac3d');

Load simulated flight trajectory data (simdata), located in matlabroot\toolbox\aero\astdemos.

load simdata;

Set the time series data for the body.

h.Bodies{1}.TimeSeriesSource = simdata;

Create a figure object for the animation object.

h.show();