Access to memory store via global in matlab function
이전 댓글 표시
Don't know how I managed this

Note how the second error report one simulation time step later exactly contradicts the first one from t=0.
I'm just using a matlab function to access a Simulink data store.
Here are the settings for it

Here is the code that raises the errors
% t is input from a clock block
% size(Screen)=[5 8]
function DOIT(t, Screen)
global CurrentSEPScreen;
if t==0 % Initialise - Shouldn't be necessary, but errors are raised
% Can't get rid of that error, trying different initialisation approaches.
Y=[32 32 32 32 32 32 32 32];
% CurrentSEPScreen(1,:)=Y;
% CurrentSEPScreen(2,:)=Y;
% CurrentSEPScreen(3,:)=Y;
% CurrentSEPScreen(4,:)=Y;
% CurrentSEPScreen(5,:)=Y;
CurrentSEPScreen=[Y;Y;Y;Y;Y];
else
for RowN=1:5
if any(Screen(RowN,:)~=CurrentSEPScreen(RowN,:))
CurrentSEPScreen(RowN,:)=Screen(RowN,:);
end
end
end
end
답변 (1개)
Fangjun Jiang
2018년 10월 24일
0 개 추천
I think the warning message is clear. If you want to ignore this, go to Simulation, Model Configuration Parameters, Diagnostics, Data Validity, Data Store Memory block, and change the setting.
댓글 수: 6
John Carter
2018년 10월 24일
편집: John Carter
2018년 10월 24일
Fangjun Jiang
2018년 10월 24일
They are not contradicting. These write-after-write and read-before-write could all happen during the same simulation step. You can change the setting to ignore them.
John Carter
2018년 10월 25일
편집: John Carter
2018년 10월 25일
Fangjun Jiang
2018년 10월 25일
The setting regarding how to report these data store memory access abnormally, either "use local settings", "disable all", "enable all as warnings" or "enable all as errors".
John Carter
2018년 11월 1일
편집: John Carter
2018년 11월 1일
John Carter
2018년 11월 1일
편집: John Carter
2018년 11월 1일
카테고리
도움말 센터 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
