Problems using mmreader with struct

2 次查看(过去 30 天)
Bran
Bran 2014-9-8
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