필터 지우기
필터 지우기

How to use workspace values ​​as parameters in MatlabFunction?

조회 수: 9 (최근 30일)
Wu YiDau
Wu YiDau 2024년 3월 21일
댓글: Dinesh 2024년 3월 21일
Hi,
I would like to ask Matlab Function how to call the values ​​in Workspace Matrix.
This is my Workspace Matrix
and this is my Matlab Function
Show This ERR.

답변 (1개)

Dinesh
Dinesh 2024년 3월 21일
Hello,
In MATLAB functions, if you would like to use a variable from the workspace rather than the ones passed as function arguments, you can use the "evalin" function with the first argument as 'base'.
Link to the documentation:
Here's a code snippet:
pmsm = evalin('base', 'pmsm');
p1 = 3 * pmsm.pp;
  댓글 수: 2
Wu YiDau
Wu YiDau 2024년 3월 21일
Thank you for your reply, but used your suggestion.
Matlab gave me another ERR Report.
Dinesh
Dinesh 2024년 3월 21일
For code generation, I don't think "evalin" is supported because there is no such concept of a workspace once the code is generated in C. It is expected that the function arguments or any global variables are the ones that are being used within the function.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by