matlab code for automated images slideshow?

hi all, i want images sledeshow in my gui but make sure that images slides must be change automatically..kindly help

 채택된 답변

Shivaputra Narke
Shivaputra Narke 2014년 2월 1일

0 개 추천

Hope this helps... imgNameList=char('camerman.tif','Image.jpg','image2.jpg'); pause on; for i=1:length(imgNameList) a=imread(imgNameList(i,:)); imshow(a); drawnow; pause(1); end
%%% the above code runs only once %% better you use timer .

추가 답변 (2개)

Mischa Kim
Mischa Kim 2014년 2월 1일

0 개 추천

Romasha, have you checked out this entry in the File Exchange?
Shivaputra Narke
Shivaputra Narke 2014년 2월 1일

0 개 추천

% if you want to use with timer %% create a timer %%% create a new file with following code and name it as main .
global indx indx=1; showTimer=timer('timerFcn',@slideshow); set(a,'ExecutionMode','fixedRate'); set(a,'Period',2) %% 2 sec delay start(a)
%%% create a function function slideshow(varargin) global indx imgNameList= char('img1.tif','img2.tif','img3.tif'); indx=indx+1; if indx> length(imgNameList) indx=1; end imshow(a); drawnow;
%%% Now run main file

댓글 수: 5

romasha
romasha 2014년 2월 1일
how can i run this code i mean it has error do i write this code in main.m file? %%% create a function function slideshow(varargin) global indx imgNameList= char('img1.tif','img2.tif','img3.tif'); indx=indx+1; if indx> length(imgNameList) indx=1; end imshow(a); drawnow;
what is the error?
You have two create two files. one that is your main file normal script other is function file.
create a new file and save it as slideshow and enter following code
function slideshow(varargin) global indx imgNameList= char('img1.tif','img2.tif','img3.tif'); indx=indx+1; if indx> length(imgNameList) indx=1; end imshow(a); drawnow;
%%% End of function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Now create new file and save it as you want with following code,
global indx indx=1; showTimer=timer('timerFcn',@slideshow); set(a,'ExecutionMode','fixedRate'); start(a)
romasha
romasha 2014년 2월 1일
i did as u said but there is an error
Error: main Undefined function or variable 'a'.
Error in main (line 3) set(a,'ExecutionMode','fixedRate');
>>
replace a by showTimer

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Fluid Dynamics에 대해 자세히 알아보기

제품

질문:

2014년 2월 1일

댓글:

2014년 2월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by