Matlab2013a中simulink仿真无法启动C编译器的解决方法

错误信息:
"Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks.

Use 'mex -setup' to select a supported C-compiler."

使用mex -setup 选择VS2012之后还是出错,使用低版本2010a或者高版本2014b时可以运行。

参考Mathworks的官方支持,发现bug及解决方案如下:

Summary

Stateflow charts and MATLAB Function blocks do not work with Microsoft Visual Studio (MSVC) 2012.

Description

When you select Microsoft Visual Studio (MSVC) 2012 as your MEX compiler, you get an error if you try to update a Simulink model that contains Stateflow charts or MATLAB Function blocks. Here is the error message:

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

Workaround

Installation instructions

  1. Log in to an account with appropriate permissions to overwrite files in your MATLAB installation.
  2. Locate your MATLAB installation by typing matlabroot at the MATLAB command prompt. This folder is referred to as  in subsequent steps.
  3. Exit MATLAB.
  4. Download the attached .zip file associated with this Bug Report and store the file in the  folder.
  5. Make a backup copy of each of the files listed in the .zip file. To see the contents of the .zip file:
    • Windows Systems*: Open the .zip file and look at the contents.
  6. Extract the files from the .zip file.
    • Windows Systems*:
      1. Open the .zip file.
      2. Extract the contents of the file to your  folder.
  7. Delete the .zip file in the  folder.
  8. Launch MATLAB and run "mex -setup" in the command window. Select MSVC 2012 as the default compiler.

*Notes for Windows Systems:

  1. If you see “Error: Access is denied” when attempting to extract the .zip file, you may need to start WinZip in administrator mode. Do this by navigating to WinZip.exe or the WinZip Start menu entry, right-clicking on it, and selecting Run as administrator.
  2. From within WinZip, find and open the downloaded .zip file.
  3. Extract the contents of the file to your  folder.

Change log::

  1. May 10, 2013: attachment_931218_13a_2013-05-10.zip: initial version, works on R2013a only.

Fix

This bug was fixed as of R2013b(8.2).

If you have a current subscription to MathWorks Software Maintenance Service (SMS), you can download product updates. If not, learn more about MathWorks SMS.

Attachments

  • attachment_931218_13a_2013-05-10.zip 

Exists in

Product Name Release (Version)
 
Simulink R2013a (8.1)
补丁可以通过https://www.mathworks.com/support/bugreports/931218下载,后续版本已经解决这一问题

或者到这里http://download.csdn.net/detail/u012565167/9767015

你可能感兴趣的:(Matlab,matlab,simulink,bug,2013a)