title: How to deal with video frames in simulink
body: <p>I am working on videos in simulink.As we know that multimedia file block reads one frame at a time so when I will attach it with matlab function block it should read one frame at a time with imread command. If I double click the matlab function block (as shown at <a href="http://tinypic.com/view.php?pic=dggujd&amp;s=6" rel="nofollow">http://tinypic.com/view.php?pic=dggujd&amp;s=6</a>) then you will see that I have to give the name of the function as written in matlab mfile along with the input; which in this case is video(named as convid.avi). I am reading one frame at a time but I have given the whole video as an argument to the matlab function.This is the problem how can I resolve it.What should be given as an argument in matlab function block rather than the whole video.I have also uploaded my model at <a href="http://tinypic.com/view.php?pic=55jggw&amp;s=6" rel="nofollow">http://tinypic.com/view.php?pic=55jggw&amp;s=6</a>. The code which I am using for vidfunc is:</p>
  
  <pre><code>function h=vidfunc(u)
  a=imread(u); % read frame
  BW = edge(a,'sobel'); %sobel edge detection
  [H,thetaa,rhoo]=hough(BW); % Hough Transform
  P = houghpeaks(H,6,'threshold',ceil(0.5*max(H(:))));
  lines=houghlines(BW,thetaa,rhoo,P,'FillGap',15,'Minlength',15)
  figure,imshow(I),hold on
  for k = 1:length(lines) % Draw lines
   xy = [lines(k).point1; lines(k).point2];
   z(k)=lines(k).point2(2);
   plot(xy(:,1),xy(:,2),'LineWidth',1,'Color','green');
   end
   h=z(k)
  </code></pre>