Unrecognized function or variable

8 ビュー (過去 30 日間)
Suvo Ganguli
Suvo Ganguli 2021 年 3 月 5 日
回答済み: Sai Teja G 2023 年 10 月 13 日
I have an s-function called smn_sfunc_gam_mpass_epsposdef.mexw64'.
When I try to simulate the s-function in Simulink, I am getting an error:
"Unrecognized function or variable 'smn_sfunc_gam_mpass_epsposdef'"
I am giving the command in the same folder as that of the s-function, so path should not be an issue.
Any idea what's going on?
Thanks.
  2 件のコメント
Steven Lord
Steven Lord 2021 年 3 月 5 日
This may seem like an obvious question, but are you running Simulink on a 64-bit version of Windows? Files with the .mexw64 extension only run on 64-bit Windows.
Suvo Ganguli
Suvo Ganguli 2021 年 3 月 5 日
Yes, I am using 64 bit Windows.

サインインしてコメントする。

回答 (1 件)

Sai Teja G
Sai Teja G 2023 年 10 月 13 日
Hi Suvo,
I understand that you are facing an error while simulating the S-function in the Simulink.
Since you haven't shared the file, it is possible that the error is caused by the following reasons:
  1. MATLAB may not automatically search the current working directory for functions or variables, even if you are executing the command in the same folder as the S-function. To resolve this, you can use the “addpath()” command to explicitly add the S-function's directory to the MATLAB search path.
  2. The "Unrecognized function or variable" error can occur if the S-function is not built or compiled correctly. Ensure that you have compiled the S-function using the appropriate build process or command. Refer to the documentation or instructions provided with the S-function for the correct steps to build it. Refer to the documentation or instructions provided with the S-function for the correct steps to build it.
Hope this resolves your query!
Best Regards,
Sai Teja G

カテゴリ

Help Center および File ExchangeBlock and Blockset Authoring についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by