Documentation Center

  • Trial Software
  • Product Updates

mplay

View video from MATLAB workspace, multimedia file, or Simulink model.

Syntax

mplay
mplay('filename.avi')
mplay('filename.avi',FPS)
mplay(A)
mplay(A,FPS)
mplay({line_handles})
mplay({'block',PORT})

Description

    Note:   The mplay function will be removed in a future release. Use the implay function with functionality identical to mplay.

mplay opens an MPlay GUI that allows you to view video from files, the MATLAB® workspace, or Simulink® signals. The MPlay GUI does not play audio.

mplay('filename.avi') connects the MPlay GUI to the specified AVI file.

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. All ports on the specified block are selected if PORT is omitted.

Input Arguments

A

A is a variable in the MATLAB workspace, which must have one of the following formats:

  • MATLAB movie structure

  • Intensity video. This input is an M-by-N-by-T or M-by-N-by-1-by-T array, where the size of each frame is M-by-N and there are T image frames.

  • RGB video array. This input is an M-by-N-by-3-by-T array, where the size of each RGB image is M-by-N-by-3 and there are T image frames.

For performance considerations, the video input A data type converts to uint8 as follows:

Supported Data TypesConverted to uint8
double
single
int8
uint8 
int16
uint16 
int32
uint32
Boolean
Fixed point

block

block is a full path to a specified Simulink 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

port refers to a Simulink block output port number.

Examples

% Create a video
  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 the figure
		close(fig);

% Display video player. Click play button on display 
		mplay(video); 

Play an AVI file

Play an AVI video file.

Play an AVI file.

mplay('vipwarnsigns.avi');

Animate a sequence of images.

load cellsequence
mplay(cellsequence,10);

Play a video from a Simulink signal.

mplay({'vipmplaytut/Rotate'});

See Also

| |

Tutorials

Was this topic helpful?