필터 지우기
필터 지우기

Simulink can't see variables in base and model workspace

조회 수: 50 (최근 30일)
Andrey Kharitenko
Andrey Kharitenko 2020년 12월 17일
편집: Fangjun Jiang 2020년 12월 17일
Hello,
I have simple simulink model with a single constant source, a user-function block and a scope sink.
The function is defined by
function y = fcn(u)
y = A*u;
end
where the variable A=1 is defined in the base workspace and in the model workspace as well.
When clicking on "Explore" in simulink, one can see the variable A in the workspaces.
However, when running the simulink model, I get the following error
Undefined function or variable 'A'.
Function 'MATLAB Function' (#46.24.25), line 2, column 5:
"A"
The current folder is set in the path and I am using Ubuntu 18.04.
No settings changes to the default installation were made and restarting matlab did not solve the issue.
What could be the reason for this behaviour?

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 12월 17일
편집: Fangjun Jiang 2020년 12월 17일
You need to add "A" as a parameter for the MATLAB Function block.
Double click to open the "MATLAB Function" block editor, click "Edit Data", menu "Add", "Data", add data "A" and specify the scope as "parameter".

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by