Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Controlling For loop using matlab

2 visualizaciones (últimos 30 días)
Algorithms Analyst
Algorithms Analyst el 11 de Jun. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi Everyone
I have code which plays a video like that
vidobj=VideoReader('.avi');
frames=vidobj.Numberofframes; for f=1:frames thisframe=read(vidobj,f); figure(1);imshow(thisframe); Progress=fprintf('video is played'); end
Here I want to control this loop by displaying Progress message just one time not everytime when frames grow.Because as soon as number of frames increase the message is iteratively occuring in matlab command window.How can I control this statement?,
Thanks

Respuestas (1)

Vishal Rane
Vishal Rane el 11 de Jun. de 2013
Check the for loop counter when displaying the progress. You want to display progress only when counter is 1.
Use this if-else-end
  2 comentarios
Algorithms Analyst
Algorithms Analyst el 11 de Jun. de 2013
Good.Actaully I am detecting blob from input video by subtracting background and getting binary image.So what I am trying to do is when the blob appear it shows message in command window as I did it like that using connected component labelling
measurements = regionprops(labeledImage,'BoundingBox','Centroid');
if isempty(measurements)
fprintf('there is nothing at frame',f);
else
fprintf('it detected at frame',f);
end
But hese two messages are appearing every iteration i want to restrit them just one time for example if something detected then it shows message when something is not then it show there is nothing.
Thanks
Algorithms Analyst
Algorithms Analyst el 11 de Jun. de 2013
Any Help is appreciated

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by