| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Discrete
The Memory block outputs its input from the previous time step, applying a one integration step sample-and-hold to its input signal.
This sample model demonstrates how to display the step size used in a simulation. The Sum block subtracts the time at the previous step, generated by the Memory block, from the current time, generated by the clock.

Note Avoid using the Memory block when integrating with ode15s or ode113, unless the input to the block does not change. |
The Memory block accepts real or complex signals of any data type supported by Simulink software, including fixed-point and enumerated data types.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink in the Simulink documentation.

The output at the initial integration step. This must be set to 0 if the input data type is user-defined. Simulink software does not allow the initial output of this block to be inf or NaN.
Check this check box to cause the sample time to be inherited from the driving block. If this option is not selected, the block's sample time depends on the type of solver used to simulate the model. If the solver is a variable-step solver, the sample time is continuous but fixed in minor time step ([0, 1]). If the solver is a fixed-step solver, this [0, 1] sample time is converted to the solver's step size after sample time propagation.
Causes the block to output its input during linearization and trim. This sets the block's mode to direct feedthrough.
Enabling this check box can cause a change in the ordering of states in the model when using the functions linmod, dlinmod, or trim. To extract this new state ordering, use the following commands.
First compile the model using the following command, where model is the name of the Simulink model.
[sizes, x0, x_str] = model([],[],[],'lincompile');
Next, terminate the compilation with the following command.
model([],[],[],'term');
The output argument, x_str, which is a cell array of the states in the Simulink model, contains the new state ordering. When passing a vector of states as input to the linmod, dlinmod, or trim functions, the state vector must use this new state ordering.
Select this check box to linearize the Memory block to a unit delay when the Memory block is driven by a signal with a discrete sample time.
The State Attributes pane of the Memory block dialog box appears as follows:

Use this parameter to assign a unique name to each state. The default is ' '. If left blank, no name is assigned. Consider the following when using this parameter:
To assign a name to a single state, enter the name between quotes, for example, 'velocity' .
The state names apply only to the selected block.
To assign names to multiple states, enter a comma-delimited list surrounded by braces. For example, {'a', 'b', 'c'} . Each name must be unique.
The number of states must be evenly divided by the number of state names. There can be fewer names than states, but there cannot be more names than states.
For example, you can specify two names in a system with four states. Simulink software will assign the first name to the first two states and the second name to the last two.
To assign state names with a variable that has been defined in the MATLAB workspace, enter the variable without quotes. A variable can be a string, cell, or structure.
This parameter enables State name must resolve to Simulink signal object when you click the Apply button.
Select this checkbox to require that state name resolve to Simulink signal object. This check box is cleared by default.
This parameter is enabled by State name.
Selecting this check box enables Real-Time Workshop storage class.
From the list, select state storage class.
Auto is the appropriate storage class for states that you do not need to interface to external code.
State is stored in a global variable
model_private.h declares the state as an extern variable.
model_private.h declares the state as an extern pointer.
This parameter is enabled by State name.
Setting this parameter to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables Real-Time Workshop storage type qualifier.
During simulation, the block uses the following values:
The initial value of the signal object to which the state name is resolved
Min and Max values of the signal object
See Block State Storage and Interfacing Considerations in the Real-Time Workshop Workshop documentation for more information.
The Memory block is a bus-capable block. The input can be a virtual or nonvirtual bus signal subject to the following restrictions:
Initial condition must be zero or a nonzero scalar.
If Initial condition is zero and a State name is specified, the input cannot be a virtual bus.
If Initial condition is a nonzero scalar, no State name can be specified.
All signals in a nonvirtual bus input to a Memory block must have the same sample time, even if the elements of the associated bus object specify inherited sample times. You can use a Rate Transition block to change the sample time of an individual signal, or of all signals in a bus. See Using Composite Signals and Bus-Capable Blocks for more information.
| Bus-capable | Yes, with restrictions as noted above |
Direct Feedthrough | No, except when Direct feedthrough of input during linearization is enabled |
Sample Time | Continuous, but inherited from the driving block if you select the Inherit sample time check box |
Scalar Expansion | Yes, of the Initial condition parameter |
Dimensionalized | Yes |
Multidimensionalized | Yes |
Zero Crossing | No |
![]() | Matrix Concatenate, Vector Concatenate | Merge | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |