MATLAB: Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use ‘mex -setup’ to select a supported C-compiler.

MATLAB and Simulink Student Suitemex -setup

I'm trying to use Matlab function. When I finish my simulation and click 'run' there is an error "Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler." I have no idea where is the 'mex-setup'. Could you fix that to me. Thanks in advance! Sorry with some mistakes in grammar. I'm not a native

Best Answer

At the command line give the command
mex -v -setup
That will give you information about where it looked for compilers and what compilers it found on your system. You will likely find that you do not have one of the supported compilers installed.
You can look at https://www.mathworks.com/support/sysreq/previous_releases.html to see which compilers are supported for MATLAB and for Stateflow for your MATLAB release.
Related Question