Problems using mmreader with struct

조회 수: 2 (최근 30일)
Bran
Bran 2014년 9월 8일
답변: Geoff Hayes 2014년 9월 9일
I am trying to use mmreader to upload a video into MATLAB. I am trying to follow the example in the documentation, however at the line move(1:nFrames) = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),'colormap',[]);
I get the following error:
??? The following error occurred converting from struct to mmreader: Error using ==> which Argument must contain a string.
Error in ==> VIDEO2 at 16 mov(1:nFrames) = struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),'colormap',[]);
Any ideas what may be wrong?

답변 (1개)

Geoff Hayes
Geoff Hayes 2014년 9월 9일
Bran - you must be using an older version of MATLAB; on R2014a, if I try to run through the example at mmreader, I observe the error message MMREADER has been removed. Use VIDEOREADER instead.
Using the same example in R2013a, it works fine and the xylophone video is played. Though if I do the following, after I've run through the example and NOT cleared any variables
mov=xyloObj;
mov(1:nFrames) = ...
struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),'colormap',[]);
Warning: MMREADER will be removed in a future release. Use VIDEOREADER
instead.
> In mmreader.mmreader>mmreader.mmreader at 120
The following error occurred converting from struct to mmreader:
Argument must contain a string.
So nearly the same error message as you observed. Could it be that you accidentally set mov to an instance of the mmreader class?
Before running your VIDEO2 script, run the following command
clear mov
clear move
to clear the variable mov (and move since you reference both in your question). Now try your script again. Do you still observe the error message?

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by