Hi fchandur,
Could you clarify your question some more?
It sounds like you have something that currently works but you wish to condense it to run in one VI instead of running LabVIEW and then The MathWorks, Inc. MATLAB® software. If that is indeed the case then based on your picture it looks like you simply need to connect an error wire from the end of your code after the while loop to the error in terminal on your MATLAB script node. This would effectively serialize your script to run after you finished creating the .avi file.
Or do you perhaps mean that as each frame is captured you wish to convert to .bmp image files instead of waiting until the entire video is converted to an .avi?
For future reference you may wish to create a new thread since your issue isn't really related to the topic of this thread. Additionally, this is the MathScript forum so your question may be better suited for the main LabVIEW forum.
Regards,
K Scott
MATLAB® is a registered trademark of The MathWorks, Inc.