how to set colormap for indexed movie frame



I want to make a movie ,and use following codes,but error happened,I
don't understand the error info.

filelist=dir(['c:\MATLAB701\work\...\*.jpg']);
for i=1 :length(filelist)
I=imread(fullfile('c:\MATLAB701\work\...',filelist(i).name));end;
for i=1 :length(filelist)
M=im2frame(I(i));end;
scrsz = get(0,'ScreenSize');
figure('Position',[1 scrsz(4)/2 scrsz(3)/1.5
scrsz(4)/1.2]),movie(M,20);

??? Error using ==> im2frame
Indexed movie frame must have a non-empty colormap.
Error in ==> ...>pushbutton19_Callback at 3670
M=im2frame(I(i));
.


Quantcast