Simulink matlab function , import data from the workspace

조회 수: 38 (최근 30일)
jiyong park
jiyong park 2022년 8월 26일
답변: Prasanna Konyala 2022년 8월 29일
I would like to import data in position to simulink matlab function which is updating.
If I type "position.data" on command window, it shows the value.
How should l import it?
this is obviously not working.
Can you also tell me how I can import the value in the case of updating position.data value?
Thanks

답변 (1개)

Prasanna Konyala
Prasanna Konyala 2022년 8월 29일
From my understanding you are trying to use base workspace variable “position” in the function.
Function workspace is different from base workspace. We can’t access base workspace variables in function. To access base variable in function we need to make the variable global. Making variable global allows it to be used in all the function definitions.
Please refer to the following document capturing more information on how to access base workspace variable in function workspace:
Hope this helps!

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by