If I understand correctly, it sounds like you want to have a Lookup Table block with index and table values that can be dynamically updated during the course of the simulation. I believe you can do this using a From File block, a Demux block, and a Lookup Table Dynamic block. Let's say you have a .mat file containing an array of the following form:
[ time_1 time_2 time_3 ...; %# Time stamps
index1_1 index1_2 index1_3 ...; %# Index 1 for all time stamps
index2_1 index2_2 index2_3 ...; %# Index 2 for all time stamps
...
indexN_1 indexN_2 indexN_3 ...; %# Index N for all time stamps
value1_1 value1_2 value1_3 ...; %# Table value 1 for all time stamps
value2_1 value2_2 value2_3 ...; %# Table value 2 for all time stamps
...
valueN_1 valueN_2 valueN_3 ...] %# Table value N for all time stamps
For each column, there is a time stamp, N
elements for the lookup table indices, and N
elements for the table values. Once loaded using the From File block, the output of length 2*N
can be split into two outputs each of length N
(i.e. the indices and the table values) using the Demux block. These two arrays can then be used for the xdat
and ydat
inputs to the Lookup Table Dynamic block, thus creating a lookup table whose index and table values can be updated from a file as the simulation runs.
Response to comment from AKE...
The time stamps are present in the above array because I was under the impression that you wanted to change the lookup table data as a function of simulation time (e.g. use one set of indices and table values for 0 to 10 seconds, then a different set for 10 to 20 seconds). If you want to do this, it will require some specification of the times at which the data will be changed.
However, if you only want to load one set of table data from a file at the start of the simulation, then your .mat file should only need one column with a time stamp of 0. Your sample data in A
can be easily modified accordingly:
A = load(yourDataFile); %# Load your data
A = [0; A(:)]; %# Convert it to a column vector and add a time stamp
save(yourMatFile,'A'); %# Save A to a .mat file for the From File block
With regard to your concern about the Demux block, you actually shouldn't need to specify N
. You only need to specify that it will have 2 outputs, and it will thus divide the input in half. For example, if the input is a 10-element vector, and you have two outputs specified for the block, you will get two 5-element vectors as the output.