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

조회 수: 3 (최근 30일)
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

채택된 답변

Walter Roberson
Walter Roberson 2018년 5월 26일
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.

추가 답변 (4개)

Tu Tran
Tu Tran 2018년 6월 3일
I am using Windows 7 Ultimate. Does that mean I can't use the compiler cause my Windows version is not on the supported list.
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 6월 3일
Which MATLAB release are you using?
You should be able to use MATLAB provided that your release indicates it is available for Windows 7, and provided that you have SP1 or later

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


Tu Tran
Tu Tran 2018년 6월 3일
I am using MATLAB R2013a. Can I download a compiler somewhere?

Tu Tran
Tu Tran 2018년 6월 8일
Sorry for late reply. After downloading and installing the software, There is one more error occurred "Making simulation target "DTC_sfun", . . . 'DTC_sfun.bat' is not recognized as an internal or external command, operable program or batch file. "
  댓글 수: 8
Tu Tran
Tu Tran 2018년 6월 8일
I was clicking the 'Run' button and the error appeared. I have changed from a continuous solver to a discrete solver but there is the same error
Walter Roberson
Walter Roberson 2018년 6월 8일
It is not possible to just switch to discrete solver: you also need to discretize the model.
I am having some difficulties getting the powergui library block to interface properly -- but that is a number of steps further than you are getting.
There should be a number of lines of output before the message about DTC_sfun: please post those.
Also, please remind me which MATLAB version you are using.

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


Tu Tran
Tu Tran 2018년 6월 13일
편집: Walter Roberson 2018년 6월 13일
There are 2 notifications and 1 error: 1. Making simulation target "DTC_sfun", ...
'DTC_sfun.bat' is not recognized as an internal or external command,
operable program or batch file.
2. Parsing successful for machine: "DTC"(#21)
3. Code Directory :
"D:\Simulations\TDD\slprj\_sfprj\DTC\_self\sfun\src"
Machine (#21): "DTC" Target : "sfun"
Chart "VECTOR Table" (#23):
.
"c1_DTC.h"
"c1_DTC.c"
Chart "SECTOR Detection" (#31):
.
"c2_DTC.h"
"c2_DTC.c"
"DTC_sfun.h"
"DTC_sfun.c"
"DTC_sfun_debug_macros.h"
Interface and Support files:
"DTC_sfun_registry.c"
Code generation successful for machine: "DTC"

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by