How to change a global variable name in simulink (containing Data Store Memory)

조회 수: 5 (최근 30일)
Hi everyone.
When I type
open_system([docroot, '/toolbox/simulink/examples/dsm_demo'])
in MATLAB command box, a simulink model opens and fully works. (As you can try)
I changed matlab function inside the model to
function y = fcn
global B;
B = B+1;
y = B;
and renamed data store memory to 'B' (even I clicked on 'refresh')
But after that simulink gives an error as below:
"Data Store Memory block with name 'A' was not found for chart 'MATLAB Function'."
Can anyone help me to find out what's wrong? I'm testing that code to use it in my main project.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2022년 5월 31일
On the MATLAB Function block Editor, click "Edit Data" and rename another "A" there.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by