Read data from data store
Simulink / Signal Routing
The Data Store Read block copies data from the named data store or a selected portion thereof to its output. More than one Data Store Read block can read from the same data store.
The data store from which the data is read is determined by the location of the Data Store Memory block or signal object that defines the data store. For more information, see Data Stores and Data Store Memory.
Obtaining correct results from data stores requires ensuring that data store reads and writes occur in the expected order. See Order Data Store Access and Data Store Diagnostics for details.
You can select a Data Store Read, Data Store Write, or Data Store Memory block to highlight blocks related to it.
IdxN
— N
th index signalExternal port specifying an index for the selection of the corresponding data store subelements.
To enable an external index port, on the Element
Assignment tab, select Enable
indexing. Then, in the N
th row of
the Index Option table, set Index
Option to Index vector
(port)
or Starting index
(port)
.
Data Types: int8
| int16
| int32
| uint8
| uint16
Port_1
— Values from specified data storeValues from the specified data store, output with the same data type and number of dimensions as in the data store. The block supports both real and complex signals. You can choose whether to output the entire data store or only selected elements.
You can use arrays of buses with a Data Store Read block. For details about defining and using an array of buses, see Group Nonvirtual Buses in Arrays of Buses.
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
| enumerated
| bus
Data store name
— Name of data store from which block readsA
(default) | name of data storeSpecify the name of the data store from which this block reads data.
The adjacent list provides the names of Data Store Memory
blocks that exist at the same level in the model as the Data
Store Read block or at higher levels. The list also includes
all Simulink.Signal
objects in the base and model
workspaces. To change the name, select a name from the list or enter the
name directly in the edit field.
When compiling a model containing this block, Simulink® searches the model upwards from the level of the block for
a Data Store Memory block having the specified data store
name. If Simulink does not find such a block, it searches the model
workspace and the MATLAB® workspace for a Simulink.Signal
object
having the same name. If Simulink finds the signal object, it creates a hidden Data
Store Memory block at the root level of the model with the
properties specified by the signal object and an initial value set to an
array of zeros. The dimensions of that array are inherited from the
Dimensions
property of the signal object.
If Simulink finds neither the Data Store Memory block nor the signal object, it halts the compilation and displays an error. See Symbol Resolution for more information about the search path.
Block Parameter:
DataStoreName |
Type: character vector |
Values: data store name |
Default:
'A' |
Data store memory block
— Data Store Memory block nameThis property is read-only.
This field lists the Data Store Memory block that initialized the store from which this block reads.
Corresponding Data Store Write blocks
— This property is read-only.
This field lists the path to all Data Store Write blocks with the same data store name as this block that are in the same (sub)system or in any subsystem below it in the model hierarchy. Click any entry in this list to highlight the corresponding block in your model.
Sample time
— Sample timeThe sample time, which controls when the block reads from the data
store. A value of -1
indicates that the sample time
is inherited. See Specify Sample Time
for more information.
Block Parameter:
SampleTime |
Type: character vector |
Values: scalar | vector |
Default:
'-1' |
Elements in the array (Signals in the bus)
— Elements in associated data storeList of elements in the associated data store. For data stores containing arrays, you can read the whole data store, or you can specify one or more elements of the data store. For data stores with a bus data type, you can expand the tree to view and select the bus elements. The list displays the maximum dimensions for each element in parentheses.
If Enable indexing is not selected, select an element and use one of the following approaches:
Click Select>> to display that element and all its subelements in the Selected element(s) list.
Use the Specify element(s) to select edit box to specify the subelements that you want to select for reading. Then click Select>>.
To select multiple elements, repeat the above procedure for each element.
Alternatively, you can select Enable indexing, then select a single element and specify the subelements dynamically using the Index Option parameter.
To refresh the display and reflect modifications to the array or bus used in the data store, click Refresh.
The prompt for this section (Elements in the array or Signals in the bus) depends on the type of data in the data store.
Block Parameter:
DataStoreElements |
Type: character vector |
Values: pound-delimited list of elements (See Specification using the command line.) |
Default:
'' |
Specify element(s) to select
— MATLAB expression defining element to selectEnter a MATLAB expression to define a specific element that you want to read, then click Select>> to add the element to the Selected elements(s) table. Repeat to select additional elements.
For example, for a data store named DSM
that has
maximum dimensions of [3,5]
, you could enter
expressions such as DSM(2,4)
or DSM([1
3],2)
in the edit box. See Accessing Specific Bus and Matrix Elements.
To apply the element selection, click OK or Apply.
The Specify element(s) to select edit box appears only if Enable indexing is not selected.
Block Parameter:
DataStoreElements |
Type: character vector |
Values: pound-delimited list of elements (See Specification using the command line.) |
Default:
'' |
Selected element(s)
— List of selected elementsElements that you select from the data store. The Data Store Read block icon displays an output port for each element that you specify.
To change the order of bus or matrix elements in the list, select the element in the list and click Up or Down. Changing the order of the elements in the list changes the order of the ports. To remove an element, click Remove.
The Selected element(s) table appears only if Enable indexing is not selected.
Block Parameter:
DataStoreElements |
Type: character vector |
Values: pound-delimited list of elements (See Specification using the command line.) |
Default:
'' |
Enable indexing
— Enable indexing to specify subelements of data store element to readSelect this parameter to enable indexing similar to that used by the Selector block, whereby you can dynamically specify indices of subelements to read by using one or more index input ports, as well as specifying indices by using the block dialog. A Data Store Read block can read from only a single element of a data store (that is, a single signal in a bus) when this parameter is selected. To read from multiple elements of a data store using dynamic indexing, use multiple Data Store Read blocks.
Clear this parameter to disable Selector block-style indexing. You can select multiple data store elements to read, but you can specify which subelements to read only by using the block dialog.
Note
Do not select Enable indexing if the associated data store contains only a single, scalar element.
Block Parameter:
EnableIndexing |
Type: character vector |
Values:
'off' | 'on' |
Default:
'off' |
Number of dimensions
— Number of dimensions of data store elementNumber of dimensions of selected data store element. You must explicitly indicate this number.
This parameter is enabled only if Enable indexing is selected.
Block Parameter:
NumberOfDimensions |
Type: character vector |
Values: positive
integer |
Default:
'1' |
Index mode
— Index modeOne-based
(default) | Zero-based
Select the indexing mode. If One-based
is
selected, an index of 1 specifies the first element of the input vector.
If Zero-based
is selected, an index of 0
specifies the first element of the input vector.
This parameter is enabled only if Enable indexing is selected.
Parameter:
IndexMode
|
Type: character vector |
Values:
'Zero-based' | 'One-based'
|
Default:
'One-based'
|
Index Option
— Index method for subelementsIndex vector
(dialog)
(default) | Select all
| Index vector (port)
| Starting index (dialog)
| Starting index (port)
Define, by dimension, how the subelements of the selected data store element are to be indexed. From the list, select:
Menu Item | Action |
---|---|
Select all | All subelements are read. |
Index vector
(dialog) | Enables the Index column. Enter a vector containing the indices of subelements to be read. |
Index vector
(port) | The relevant index port defines the indices of subelements to be read. |
Starting index
(dialog) | Enables the Index and Output Size columns. Enter the starting index and size of the range of subelements to be read. |
Starting index
(port) | Enables the Output Size column. The relevant index port defines the starting index of the range of elements to be read. Enter the size of the range. |
The Index and Output Size columns are displayed as relevant.
This parameter is enabled only if Enable indexing is selected.
Parameter:
IndexOptionArray
|
Type: character vector |
Values:
'Select all' | 'Index vector
(dialog)' | 'Index vector
(port)' | 'Starting index
(dialog)' | 'Starting index
(port)' |
Default:
'Index vector (dialog)'
|
Index
— Indices or starting index of subelements1
(default) | integer | vector of integersIf the Index Option is Index vector
(dialog)
, enter a vector containing the indices of
each subelement to read.
If the Index Option is Starting
index (dialog)
, enter the starting index of the range
of subelements to read.
This parameter is enabled only if Enable
indexing is selected and the Index
Option for the dimension is Index vector
(dialog)
or Starting index
(dialog)
.
Parameter:
IndexParamArray
|
Type: character vector |
Values: cell array |
Default:
'{ }'
|
Output Size
— Size of range of subelements to read1
(default) | integerIf the Index Option is Starting
index (dialog)
or Starting index
(port)
, enter the size of the range of subelements to
read.
This parameter is enabled only if Enable
indexing is selected and the Index
Option for the dimension is Starting
index (dialog)
or Starting index
(port)
.
Block Parameter:
OutputSizeArray
|
Type: character vector |
Values: cell array |
Default:
'{ }'
|
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.