| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Video and Image Processing Blockset |
| Contents | Index |
| Learn more about Video and Image Processing Blockset |
mplay
mplay('filename.avi')
mplay('filename.avi',FPS)
mplay(A)
mplay(A,FPS)
mplay({line_handles})
mplay({'block',PORT})
mplay opens an MPlay GUI that allows you to view video from files or the MATLAB workspace. The MPlay GUI does not play audio.
mplay('filename.avi') connects the MPlay GUI to the specified AVI file. You can also view video signals in Simulink models.
mplay('filename.avi',FPS) plays the specified frame rate in frames per second, (FPS). The FPS value equals that of the frame rate specified in the file.
mplay(A) connects the MPlay GUI to the variable in the MATLAB workspace, A.
mplay(A,FPS) plays the specified frame rate in frames per second, FPS. The FPS value defaults to 20.
mplay({line_handles}) connects the MPlay GUI to one or three Simulink signal lines to display, where all signals must originate from the same block.
mplay({'block',PORT}) connects the MPlay GUI to the output signal of the specified block, 'block', on output port port. The port index value defaults to 1.
A |
A is a variable in the MATLAB workspace, which must have one of the following formats:
For performance considerations, the video input A data type converts to unit8 as follows:
| ||||||||||||||||||||||
block |
The block is a full path to a specified Simulink blockset block. To get the full block path name of the currently selected Simulink block, issue the command mplay({gcb,1}) on the MATLAB command line. | ||||||||||||||||||||||
filename.avi |
Filename.avi is a specified AVI file. | ||||||||||||||||||||||
FPS |
FPS stands for frames per second. You can specify the frame rate in frames per second. | ||||||||||||||||||||||
line_handles |
line_handles are Simulink signal lines. To get the handles to the Simulink signals, line_handles, issue the command mplay({gsl}) on the MATLAB command line. | ||||||||||||||||||||||
port |
The port refers to a Simulink block output port number. |
Play a video created in MATLAB workspace.
fig=figure; % create a video
set(gca,'xlim',[-80 80],'ylim',[-80 80],'NextPlot', ...
'replace','Visible','off');
x = -pi:.1:pi;
radius = 0:length(x);
video = []; % initialize video variable
for i=length(x):-1:1
patch(sin(x)*radius(i),cos(x)*radius(i), ...
[abs(cos(x(i))) 0 0]);
F = getframe(gca);
video = cat(4,video,F.cdata); % video is MxNx3xT
end
close(fig);
mplay(video); % display a videoAccess this GUI by selecting Tools > MPlay Video Viewer.
To Video Display | Video Viewer
![]() | isfilterseparable |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |