Main Content

Detect write after read


Select the diagnostic action to take if the model attempts to write data to a data store after previously reading data from it in the current time step.

Category: Diagnostics


Default: Use local settings

Use local settings

For each local data store (defined by a Data Store Memory block or Simulink.Signal object in a model workspace) use the setting specified by the block. For each global data store (defined by a Simulink.Signal object in the base workspace) disable the diagnostic.

Disable all

Disables this diagnostic for all data stores accessed by the model.

Enable all as warnings

Displays diagnostic as a warning at the MATLAB® command line.

Enable all as errors

Halts the simulation and displays the diagnostic in an error dialog box.


During model referencing simulation in accelerator and rapid accelerator mode, if the Detect write after read parameter is set to Enable all as warnings, Enable all as errors, or Use local settings, Simulink® temporarily changes the setting to Disable all.

You can use the Model Advisor to identify referenced models for which Simulink changes configuration this parameter setting during accelerated simulation.

  1. In the Simulink Editor, in the Modeling tab, click Model Advisor, then click OK.

  2. Select By Task.

  3. Run the Check diagnostic settings ignored during accelerated model reference simulation check.

Command-Line Information

Parameter: WriteAfterReadMsg
Value: 'UseLocalSettings' | 'DisableAll' | 'EnableAllAsWarning' | 'EnableAllAsError'
Default: 'UseLocalSettings'

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionEnable all as errors

See Also

Related Topics