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

8 Ansichten (letzte 30 Tage)
Micah Thorpe
Micah Thorpe am 22 Jun. 2021
Beantwortet: Kunal Kandhari am 22 Jun. 2021
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]);

Antworten (1)

Kunal Kandhari
Kunal Kandhari am 22 Jun. 2021
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

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by