MATLAB Answers

Error while executing a MATLAB function block.

2 views (last 30 days)
Prakash Ji barnawal
Prakash Ji barnawal on 26 Sep 2020
Commented: Walter Roberson on 26 Sep 2020
I tried to generate the switching signals via using the power signals with the help of MATLAB function block.
Aftre running the simulation i found the errors like below:
  1. Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler.

  0 Comments

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 26 Sep 2020
The first one on the list can only be used if you are using 32 bit Windows version of MATLAB.
The second one, SDK 7.1, can be difficult to install if you are using Windows 10.
The other ones are commercial (not free). You cannot use any of the Visual Studio "Express" or "Community" editions for a release that old: SDK 7.1 was the "Community" edition of those days.
Once you have installed a compiler (or chosen to use lcc), go to the MATLAB command line and command
mex -setup -v
and follow the prompts to register your compiler with MATLAB. If you run into problems, post the output of the mex -setup -v operation.

  2 Comments

Walter Roberson
Walter Roberson on 26 Sep 2020
For this purpose what is important is not whether your operating system is 64 bit, but rather whether you are running the 64 bit version of MATLAB. When you are running a 64 bit versions of Windows, you could run either the 32 bit or 64 bit version of MATLAB, at least up to R2015b.
Anyhow, if you are using the 64 bit version of MATLAB then your options are SDK 7.1, or one of the commercial compilers listed in the link above.
Installing SDK 7.1 on Windows 7 is not bad (though sometimes you needed to uninstall .NET and install SDK 7.1 and then reinstall .NET), but installing SDK 7.1 on Windows 10 can be a challenge.

Sign in to comment.

Products


Release

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by