Finding Data Store Read and Data Store Write blocks
I was recently dealing with a system of Simulink models that makes use of DataStoreRead and DataStoreWrite blocks to communicate data (basically global variables) between the separate systems in the software. I was having trouble finding the corresponding Data Store Read blocks for a particular Data Store Write block. I couldn’t figure out how to do quickly lookup this information using Matlab’s built-in tools. I’m guessing this was due to the fact that the blocks were in different referenced subsystems
After doing some searches, I found out about a Matlab function for working with Simulink models called find_system. Using find_system and get_param I was able to whip up a small function called FindDataStoreBlocks that takes as parameters a model name and the name of a data store. The function would then search through all referenced models in the specified model to find where this data store name is used in a Data Store Read block or a Data Store Write block.
You can download FindDataStoreBlocks from github.
The following code can be used to exercise this function:
Perhaps there is a better way to do a search like this in Matlab, but I couldn’t find it.
