S-function does not exist error!

65 ビュー (過去 30 日間)
Mahmud Khan
Mahmud Khan 2018 年 9 月 19 日
コメント済み: Joel Davis 2023 年 9 月 18 日
I am trying to test this Matlab model which uses a random signal generator and both a Matlab based S-function block (a dot m file) and a C code based S-function block ( dot c file).When I run this model, I get the following error:
I tried to find solutions for a while and realised that the MEX file in that folder is probably what the s-function block uses to utilise the C-code. I also found out that the MEX file in that folder may not be compatible with my version of Matlab. As a result, I tried to use the "mex" command:
mex secondOrder_c.c)
That gave me the following error:
Error using mex
No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler;
see Install MinGW-w64 Compiler. For more options, visit
http://www.mathworks.com/support/compilers/R2017a/.
I'd appreciate some help with this process. Is this happening to me because my computer has no C/C++ compilers installed? I have Visual Studio 2017 installed on the same computer. Doesn't that count for anything? Does the fact that Matlab didn't detect that software imply that it's useless?
I'd really like some help with this so that I can resume learning from the book where I came across this s-function thing.

採用された回答

Mahmud Khan
Mahmud Khan 2018 年 9 月 19 日
This is me answering my own question:
What went wrong is that my installation of Matlab 2017a didn't come with the correct files needed for this job. As a result, I downloaded the patch from here:
There were two useful files inside the tiny zip file within a folder called bin. I just had to find the same folder under my Matlab installation folder and copy-paste these two files in there. Just follow the instructions on that page to fix this problem.
I had no previous copies of these two files in my Matlab directory so I didn't have to back anything up. I only had to add these two files to the directory under the Matlab folder bin/Win64/mexopts
This patch helped me fix the problem I was facing in generating MEX files and now my model runs just fine. :)
Hope this helps someone else too.
  2 件のコメント
MAYOWA OLADELE
MAYOWA OLADELE 2023 年 1 月 10 日
編集済み: MAYOWA OLADELE 2023 年 1 月 10 日
Hello, I'm currently having this issue. I've tried your answer but it keeps giving me the same error. I don't know what else to do. Please can you help me?!
Joel Davis
Joel Davis 2023 年 9 月 18 日
it may be because the attachments are configured with Matlab 2017, if your using the latest release. I'm using 2022a release and not sure what to do now

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

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2018 年 9 月 19 日
run "mex -setup" to select VC2017 as the compiler and then run mex.
  6 件のコメント
Mahmud Khan
Mahmud Khan 2019 年 2 月 7 日
MAYOWA OLADELE
MAYOWA OLADELE 2023 年 1 月 10 日
I also used that answer but I'm still getting the same error

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

カテゴリ

Help Center および File ExchangeTroubleshooting in MATLAB Compiler SDK についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by