How to make the value in Data Store Memory global

조회 수: 2 (최근 30일)
Kristian Shyti
Kristian Shyti 2021년 8월 6일
답변: Fangjun Jiang 2021년 8월 6일
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?

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2021년 8월 6일
Most likely, step 3 is missed.
3. Make sure the global variable is registered to the MATLAB Function block

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by