How to make the value in Data Store Memory global
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a simulink model that generates signals, I want to store the signal using data store write and data store memory (those are linked together), then I want to be able to use the stored signal (an array) as a global variable in MATLAB.
When I try to make the variable global in matlab nothing happens. Even after I start the simulation
global Signal_full_og; % the variable I want to make global
sig_arr = [];
sim simF.slx;
for vref 1:1:5 % first few signals will get generated with different vrefs in the model
sig_arr(index, :) = Signal_full_og;
end
Below there is a picture of the Data Store Write and Data Store Memory from my Simulink model
And below there is a picture of the block parameters of Data Store Memory
I have tried to follow the documentation from Mathworks and still I can't get a global variable. Does anyone spot any mistakes in this way or is there a better way to do the same thing?
댓글 수: 0
답변 (1개)
Fangjun Jiang
2021년 8월 6일
The example is here. https://www.mathworks.com/help/simulink/ug/using-global-data-with-the-matlab-function-block.html
Most likely, step 3 is missed.
3. Make sure the global variable is registered to the MATLAB Function block
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!