There is an example of how to create background targets from your target table in the background target example task. That version shows 10 targets at a time. One thing you may have noticed with that example is that the targets show up on the screen in order one at a time and they each take 1/60th of a second to show. This is because your task program needs to wait to ensure each new background target has been accepted. This works reasonably well for up to 60 targets because that will only take ~1s to send all targets.
This example demonstrates several concepts:
Dynamically creating large numbers of VCodes
Sending those VCodes in blocks (in this case 30 at a time)
Adding extra Stateflow charts to you model
Calling Matlab from Stateflow
What this example does specifically is:
Take in one “large” rectangular VCode, one small rectangular “tile” VCode, a number of tiles in the X and Y directions.
Creates X * Y “tile” VCodes that will completely cover the space defined by the “large” VCode
Turns on all of the “tiles” 30 at a time
Waits a specified duration
Turns off all the “tiles” 30 at a time
There is no interaction with the tiles, extending this model to interact with the tiles would not be hard. Limitations of the example are:
Up to 500 targets can be created (read comments in the model for how to make this larger)
Up to 30 targets at a time are sent (read comments in the model for how to make this larger)
All targets are assumed to be rectangular.
You can watch the shapes fill in with tiles. An easy extension to this would be to display a large black target over top of the permanent targets while they are being filled in and remove the black target when the tiling is done.
This was made with MATLAB 2013a and compiled for Dex 3.5.