Undefined function or variable 'aviread'. >> aviread('traffic.avi'); Undefined function or variable 'aviread'.

13 views (last 30 days)
clear all source = aviread('traffic.avi'); % Load video file N=0;
Here the error came on r2016 version matlab? how to resolve?

Answers (3)

Honglei Chen
Honglei Chen on 8 Feb 2017
aviread is not part of MATLAB installation provided by MathWorks. You can find it in File Exchange. However, if your goal is to read avi files, you can just use videoread in your installation.
HTH

Steven Lord
Steven Lord on 23 Sep 2024
There used to be an aviread function in MATLAB, but I believe it was removed sometime around release R2014b. The recommended replacement is VideoReader.

Konstantin
Konstantin on 23 Sep 2024

The error you're encountering may be caused by several factors in MATLAB version R2016. Here are some steps you can try to resolve the issue:

1. *Check the Video Format*: Ensure that the `traffic.avi` file is in the correct format and is not corrupted. You can verify this by opening the video in a different player.

2. *Use `VideoReader`*: In newer versions of MATLAB, it's recommended to use the `VideoReader` object instead of `aviread`. You can try the following code: ```matlab videoObj = VideoReader('traffic.avi'); N = 0; while hasFrame(videoObj) frame = readFrame(videoObj); N = N + 1; % Here you can process each frame, e.g., display it imshow(frame); pause(1/videoObj.FrameRate); % Pause according to the frame rate end ```

3. *Check File Path and Permissions*: Make sure MATLAB has access to the file and that the path to `traffic.avi` is correctly set.

4. *Update MATLAB*: If possible, consider updating to a newer version of MATLAB, as newer versions include fixes and improvements that may resolve compatibility issues.

5. *Consult Documentation*: Review the MATLAB documentation for `aviread` and `VideoReader` to ensure you're using the correct syntax and options.

If none of these steps help, please provide more information about the specific error message you're seeing so that we can better diagnose the issue.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!