MATLAB: How to write to a variable multiple times in the same time step in simulink

data storememorysimulink

I have a control loop in Simulink which writes to a variable multiple times using the DATA STORE WRITE block. I then read the most recent data value using the DATA STORE READ block. Finally, I use this value (signal) elsewhere in my program. How can I do this?
I am getting the following error:
The block 'Data Store Write2' is writing to the data store 'Data Store Memory' but the block(s) 'Data Store Read' have already read from a portion or the entire region of this memory at time 0.0. For performance reasons, occurrences of this diagnostic for this memory at other simulation time steps will be suppressed.
A simple block diagram of what I am trying to do is as follows:

Best Answer

This is a good case for using the Merge block. Connect all three outputs to a Merge block and then connect to a single "Data Store Write" block with the tag "rpm_cmd". Double click the Merge block, click the "Help" button to see the detailed explanation of the Merge block.