From: Ryan on
I need to load a avi video into workspace and do some processing work. I use the 'From Multimedia File' block in simulink to extract the audio of the avi file.
The question is that if for different avi files, i have to manually set the 'file name' of the 'From Multimedia File' everytime before start the simulation.
I can read the avi file in a .m file and get the path name and filename first. Is that possible to send these path name and filename automatically to the 'file name' in 'From Multimedia File' block when the avi file is loaded?

thx a lot~
From: witek on
Ryan,

It's possible. For example, in the workspace you can define a variable with a string:
myfile = 'barcodes.avi'

Now, use myfile variable in place of the file name. You can then manipulate myfile variable before
the start of each simulation. BTW. you may find the sim command useful to you as well.

Furthermore, the Video and Image Processing blockset in 10a release of MATLAB made the functionality
for reading video and audio data available from the MATLAB command prompt through use of System
objects. You may find them useful as well. In this case, you could call:

video.MultimediaFileReader

object, and simply manipulate its properties to change the file name. This object is quite capable
in terms of audio/video I/O. See the doc here:

http://www.mathworks.com/access/helpdesk/help/toolbox/vipblks/ref/video.multimediafilereaderclass.html

and supported formats here:

http://www.mathworks.com/access/helpdesk/help/toolbox/dspblks/ref/frommultimediafile.html

HTH,

Witek


Ryan <ryanwrz(a)gmail.com> wrote:
> I need to load a avi video into workspace and do some processing work. I use the 'From Multimedia File' block in simulink to extract the audio of the avi file.
> The question is that if for different avi files, i have to manually set the 'file name' of the 'From Multimedia File' everytime before start the simulation.
> I can read the avi file in a .m file and get the path name and filename first. Is that possible to send these path name and filename automatically to the 'file name' in 'From Multimedia File' block when the avi file is loaded?
>
> thx a lot~