In this example, you use the To Multimedia File block, the Enabled Subsystem block, and a trigger signal, to save portions of one AVI file to three separate AVI files.
You can open the example model by typing at the MATLAB® command line.
Run your model.
The model saves the three output AVI files in your current folder.
View the resulting files by typing the following commands at the MATLAB command prompt:
implay output1.avi implay output2.avi implay output3.avi
Press the Play button.
The block parameters in this example were modified from default values as follows:
|From Multimedia File||The From Multimedia File block imports an AVI
file into the model. |
|Insert Text||The example uses the Insert Text block to annotate
the video stream with frame numbers. The block writes the frame number
in green, in the upper-left corner of the output video stream.|
|To Multimedia File|
The To Multimedia File blocks send the video stream to three separate AVI files. These block parameters were modified as follows:
The Counter block counts the number of video frames. The example uses this information to specify which frames are sent to which file. The block parameters are modified as follows:
The bias block adds a bias to the input. The block parameters are modified as follows:
|Compare To Constant|
The Compare to Constant block sends frames 1 to 9 to the first AVI file. The block parameters are modified as follows:
|Compare To Constant1|
Compare To Constant2
The Compare to Constant1 and Compare to Constant2 blocks send frames 10 to 19 to the second AVI file. The block parameters are modified as follows:
The Compare to Constant2 block parameters are modified as follows:
|Compare To Constant3|
The Compare to Constant3 block send frames 20 to 30 to the third AVI file. The block parameters are modified as follows:
|Compare To Constant4|
The Compare to Constant4 block stops the simulation when the video reaches frame 30. The block parameters are modified as follows:
Each To Multimedia File block gets inserted into one Enabled Subsystem block, and connected to it's input. You can do this, by double-clicking the Enabled Subsystem blocks, then click-and-drag a To Multimedia File block into it.
Each enabled subsystem should look similar to the subsystem shown in the following figure.
You can locate the Model Configuration Parameters by selecting Model Configuration Parameters from the Simulation menu. For this example, the parameters on the Solver pane, are set as follows:
(no continuous states)