To create a video in Simulink using images based on specific conditions, you may use the following blocks and achieve the required functionality:
- Image from File: This block can be used to read the respective images from a specified location. You may use five such blocks to read each of the images corresponding to the output values.
- Multiport Switch: The “Multiport Switch” block can be used to select the image corresponding to the output value.
- Video Viewer: This block can be used to output the images from the “Multiport Switch” block to display the respective image.
- The “Stop Time” can be set to “inf” to run the simulation continuously until it is stopped.
Please refer to the documentation of the respective blocks by running the following commands in MATLAB R2020a.
Image from File:
web(fullfile(docroot, 'vision/ref/imagefromfile.html'))
Multiport Switch:
web(fullfile(docroot, 'simulink/slref/multiportswitch.html'))
Video Viewer:
web(fullfile(docroot, 'vision/ref/videoviewer.html'))