FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6400 Discussions

How to hook up external functions into Simulink blocks in DSP Builder

Honored Contributor II

I was looking at the Video and Imaging examples on the Altera design examples page: 

e.g., http://www.altera.com/support/examples/dsp-builder/exm-scaler.html#figure1.  


and they seem to have a neat way of hooking up external functions into Simulink blocks. More specifically, how they accomplish file I/O to and from the Simulink model via a pair of blocks labeled : 

"Input AVI to Binary" and "Output Binary to AVI".  


It took a bit of digging around to figure this out, so I thought I might post it for the benefit of those that were also wondering how this works: 


This is really a Simulink block called "Subsystem"; you can find it under the generic Simulink blockset under "Ports and Subsystems". Instantiate one of these in your model, double click to see Block Properties and and go to the "Callbacks" tab: scroll on the left box under "Callback functions List" to "OpenFcn": this code is hooked into the OpenFcn callback, as you can see: 

"system('avi-is-avi input.avi input.bin 176 144 AVItoIS -c RGB -v')". 


Hope that helps!:)  

0 Kudos
0 Replies