One possible solution is to "emulate" variable-sized data using a fixed-size buffer and a separate field for size. That is, create a Data Store Memory block that contains a structure (let's call it "data") with two fields, a_data and a_size. Make a_data to be of some large size (say, 1024 elements), and initialize a_size with 0.
Then, inside the MATLAB function block (presuming that the variable "data" is the global that is mapped to that Data Store Memory) do
data.a_data[data.a_size] = 1; data.a_size = data.a_size+1;
And in another block, to read the last element
x = data.a_data[data.a_size];
Note that you would need to handle cases where a_size is 0 (no data have been added) and a_size == numel(a_data) (there is no more room in the a_data array).
댓글 수: 0
로그인 to comment.