# getnext

## PURPOSE

FRAME=GETNEXT(VR)

## SYNOPSIS

function frame = getnext(vr)

## DESCRIPTION

    FRAME=GETNEXT(VR)
      This method is a shortcut for
        if (next(vr))
          frame = getframe(vr);
        else
          frame = [];
        end

      Although this method can be more convenient than calling NEXT and GETFRAME
      separately, there is no way to distinguish between a zero-sized frame and
      reading past the end of the stream.

      Typical usage:
        vr = videoReader('numbers.uncompressed.avi');
        info = getinfo(vr);
        for i=1:info.numFrames
          img = getnext(vr);
          imshow(img);
          pause(1/info.fps);
        end
        vr = close(vr);

    SEE ALSO
      videoReader
      videoReader/getframe
      videoReader/next

    Copyright (c) 2006 Gerald Dalley
    See "MIT.txt" in the installation directory for licensing details (especially
    when using this library on GNU/Linux).

## CROSS-REFERENCE INFORMATION

This function calls:

- getframe FRAME=GETFRAME(VR)
- next WORKED=NEXT(VR)
- getframe FRAME=GETFRAME(VR)
- next WORKED=NEXT(VR)
- getframe FRAME=GETFRAME(VR)
- next WORKED=NEXT(VR)

This function is called by:

## SOURCE CODE

    0001 function frame = getnext(vr)
    0002 %FRAME=GETNEXT(VR)
    0003 %  This method is a shortcut for
    0004 %    if (next(vr))
    0005 %      frame = getframe(vr);
    0006 %    else
    0007 %      frame = [];
    0008 %    end
    0009 %
    0010 %  Although this method can be more convenient than calling NEXT and GETFRAME
    0011 %  separately, there is no way to distinguish between a zero-sized frame and
    0012 %  reading past the end of the stream.
    0013 %
    0014 %  Typical usage:
    0015 %    vr = videoReader('numbers.uncompressed.avi');
    0016 %    info = getinfo(vr);
    0017 %    for i=1:info.numFrames
    0018 %      img = getnext(vr);
    0019 %      imshow(img);
    0020 %      pause(1/info.fps);
    0021 %    end
    0022 %    vr = close(vr);
    0023 %
    0024 %SEE ALSO
    0025 %  videoReader
    0026 %  videoReader/getframe
    0027 %  videoReader/next
    0028 %
    0029 %Copyright (c) 2006 Gerald Dalley
    0030 %See "MIT.txt" in the installation directory for licensing details (especially
    0031 %when using this library on GNU/Linux).
    0032
    0033 if (next(vr))
    0034   frame = getframe(vr);
    0035 else
    0036   frame = [];
    0037 end
    0038
    0039