Hi,
this is my code,
function f1()clear all;obj1 = mmreader('can.avi');obj2 = mmreader('watch.avi');obj3 = mmreader('can.avi');obj4 = mmreader('watch.avi');vid1 = read(obj1);vid2 = read(obj2);vid3 = read(obj3);vid4 = read(obj4);frame1 = 1;frame2 = 50;frame3 = 30;frame4 = 1;f4 = 1;hst1=0;hst2=0;hst3=0;hst4=0;h = figure('Name','Video ', 'NumberTitle','off','Color',[1,1,1],'Toolbar','none','Visible','on', 'Position',[80 40 1000 700],... 'Resize','on');hstat1 = uicontrol('unit','pixel','style','checkbox','value',0,'position',...[50 630 25 25]);hstat2 = uicontrol('unit','pixel','style','checkbox','value',0,'position',...[50 550 25 25]);hstat3 = uicontrol('unit','pixel','style','checkbox','value',0,'position',...[50 480 25 25]);hstat4 = uicontrol('unit','pixel','style','checkbox','value',0,'position',...[50 410 25 25]);hplay1 = uicontrol('unit','pixel','style','pushbutton','string','藥罐_PLAY',...'position',[50 630 70 40],'backgroundColor',[0.3,0.7,1],'callback',{@play1_callback});hplay2 = uicontrol('unit','pixel','style','pushbutton','string','手錶_PLAY',...'position',[50 550 70 40],'backgroundColor',[0.3,0.7,1],'callback',{@play2_callback});hplay3 = uicontrol('unit','pixel','style','pushbutton','string','書本_PLAY',...'position',[50 480 70 40],'backgroundColor',[0.3,0.7,1],'callback',{@play3_callback});hplay4 = uicontrol('unit','pixel','style','pushbutton','string','手機_PLAY',...'position',[50 410 70 40],'backgroundColor',[0.3,0.7,1],'callback',{@play4_callback});hstop1 = uicontrol('unit','pixel','style','pushbutton','string','藥罐_STOP',...'position',[50 330 70 40],'backgroundColor',[0.2,1,0],'callback',@stop1_callback);hstop2 = uicontrol('unit','pixel','style','pushbutton','string','手錶_STOP',...'position',[50 250 70 40],'backgroundColor',[0.2,1,0],'callback',@stop2_callback);hstop3 = uicontrol('unit','pixel','style','pushbutton','string','書本_STOP',...'position',[50 170 70 40],'backgroundColor',[0.2,1,0],'callback',@stop3_callback);hstop4 = uicontrol('unit','pixel','style','pushbutton','string','手機_STOP',...'position',[50 90 70 40],'backgroundColor',[0.2,1,0],'callback',@stop4_callback);hexit = uicontrol('unit','pixel','style','pushbutton','string','EXIT',...'position',[50 10 70 40],'backgroundColor',[1,0,0],'callback',@exit_callback);while (1) if hst1==1 subplot(2,2,1); imshow(vid1(:,:,:,frame1)); if frame1 < size(vid1,4) frame1 = frame1+1; else frame1 = 1; end end if hst2==1 subplot(2,2,2); imshow(vid2(:,:,:,frame2)); if frame2 < size(vid2,4) frame2 = frame2+1; else frame2 = 1; end end if hst3==1 subplot(2,2,3); imshow(vid3(:,:,:,frame3)); if frame3 < size(vid3,4) frame3 = frame3+1; else frame3 = 1; end end if hst4==1 subplot(2,2,4); imshow(vid4(:,:,:,frame4)); if frame4 < size(vid4,4) frame4 = frame4+1; else frame4 = 1; end % else
% subplot(2,2,4); imshow(vid2(:,:,:,1));
end drawnow; if f4 ==10000 break; % else f4 = f4+1;
end endfunction play1_callback(hObject0,eventdata0)set(hstat1,'value',1);hst1=1;set(hplay1 ,'backgroundColor',[1,1,0],'string','藥罐_播放中');endfunction play2_callback(hObject1,eventdata1)set(hstat2,'value',1); hst2=1;set(hplay2 ,'backgroundColor',[1,1,0],'string','手錶_播放中');endfunction play3_callback(hObject2,eventdata2)set(hstat3,'value',1); hst3=1;set(hplay3 ,'backgroundColor',[1,1,0],'string','書本_播放中');endfunction play4_callback(hObject3,eventdata)set(hstat4,'value',1); hst4=1;set(hplay4 ,'backgroundColor',[1,1,0],'string','手機_播放中');endfunction stop1_callback(hObject,eventdata)set(hstat1,'value',0);hst1=0;set(hplay1 ,'backgroundColor',[0.3,0.7,1],'string','藥罐_PLAY');endfunction stop2_callback(hObject,eventdata)set(hstat2,'value',0);hst2=0;set(hplay2 ,'backgroundColor',[0.3,0.7,1],'string','手錶_PLAY');endfunction stop3_callback(hObject,eventdata)set(hstat3,'value',0);hst3=0;set(hplay3 ,'backgroundColor',[0.3,0.7,1],'string','書本_PLAY');endfunction stop4_callback(hObject,eventdata)set(hstat4,'value',0);hst4=0;set(hplay4 ,'backgroundColor',[0.3,0.7,1],'string','手機_PLAY');endfunction exit_callback(hObject,eventdata)f4=10000;stop1_callback;close gcf;endend
but I run it, matlab show this message
??? Not enough memory available for 537 frames.Error in ==> mmreader.read at 67 videoFrames = read(getImpl(obj));Error in ==> GUIf1 at 11vid3 = read(obj3);
I don't know that I should how to do.
My computer is 32 bits and RAM is 4.0G.
Pleas give me some advice. Thank you.
Best Answer