MATLAB: Does Simulink compilation fail with ‘Potential conflicts’ when using Data Store blocks and Data Dictionaries

conflictdatadictionarygloballocalsimulinkstore

I have a model in which I use a Data Store Memory block to define a 'Temp' variable. This variable is also defined in a Data Dictionary, such that I can share it with a referenced model. I use Data Store Write inside the reference model and Data Store Read in the main model.
Whenever I try to update or simulate the model, I get the following error:
Potential conflicting usages of identifier 'Temp': the data store associated with the block 'test_error/main_system/Data Store Memory', and a global data store memory 'Temp'
How do I fix this?

Best Answer

The issue arises because there is a clash between a global and a local data store. The Simulink.Signal object 'Temp' in the Data Dictionary defines a global Data Store because it can be accessed by all models in the hierarchy. Thus, the Data Store Memory block in the main model is now redundant because it also declares a local data store named 'Temp'.
You can find more information about the creation and application of Data Stores on the following page of the documentation page:
In particular, the final sentence of the section 'Create and Apply Data Stores' should clarify this issue.
To resolve the error and continue with the simulation, you can remove the Data Store Memory block, and then Simulink will automatically read and write to the 'Temp' variable defined in the Data Dictionary. You will notice that the Data Store Read and Write blocks will show that 'Temp' is a global Data Store.