Why do I get the error "Expected index to be positive" on line 3?

조회 수: 2 (최근 30일)
Micah Thorpe
Micah Thorpe 2021년 6월 22일
답변: Animesh 2025년 5월 5일
When running these lines, I am geting the error "Expected index to be positive." and cannot figure out why.
vfull = VideoReader('LLZO0024-04-21-24.MP4');
%specific sections to read
section1 = read(vfull,[0 5]);
section2 = read(vfull,[10 15]);
section3 = read(vfull,[20 25]);

답변 (1개)

Animesh
Animesh 2025년 5월 5일
It is because indexing in matlab starts from 1 and not from 0
Changing line 3 to this:
section1 = read(vfull,[1 5]);
will solve this error.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by