Stateflow:UnexpectedError when generating Simulink model code in 2011a
이전 댓글 표시
Hoping someone has seen this before. I try to generate code for my model and receive the following errors:
Making simulation target "MESR_MC_AC_ModeMgmt_sfun", ...
'MESR_MC_AC_ModeMgmt_sfun.bat' is not recognized as an internal or external command,
operable program or batch file.
A build_exception.mat file is created in the code output directory, and it contains an exception structure with the following identifier:
Stateflow:UnexpectedError
And a message that says:
'Error using ==> targetman>throw_make_error at 588
(SLSF Diagnostic)'
I'm on 2011a 64-bit, and using Microsoft Visual C++ 2010 Express compiler selected through mbuild -setup.
Any help would be much appreciated! Thanks! Justin
답변 (6개)
Kaustubha Govind
2011년 8월 19일
All Stateflow charts and Embedded MATLAB blocks generate C code and compile them for execution, the compiler selected using the MEX -SETUP command is invoked for the compilation and linking process. At this time, MATLAB spawns a system shell to run the compiler/linker commands. By default, the spawned shell starts in MATLAB's current directory - which means that the relevant batch/source/object file is expected to be in the present working directory.
However, if your system is configured to start the system shell in a different directory than the current one, this assumption fails.
To verify this execute the following commands in MATLAB (they should return the same path for the default configuration)
>> cd
>> !cd
If you find that the second command returns a different folder, check to see if you have made any settings to force a starting directory for cmd.exe. (One way that such a setting can be made is using the Windows Registry keys HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun (or) HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun)
Another thing to make sure is that you're not working in a UNC path (ie, a network directory that has not been mapped to a letter)
Justin
2011년 8월 19일
0 개 추천
댓글 수: 7
Kaustubha Govind
2011년 8월 19일
Are you running on Windows 7 by any chance? If so, could you try starting MATLAB as Administrator and try again? My best bet is that Windows is not allowing MATLAB to generate any files to the folder.
Justin
2011년 8월 19일
Kaustubha Govind
2011년 8월 19일
Do you see MESR_MC_AC_ModeMgmt_test_sfun.bat inside the slprj folder? If yes, could you try running it from MATLAB like so:
>> !MESR_MC_AC_ModeMgmt_test_sfun
The Stateflow:UnexpectedError is coming from the Embedded MATLAB not being able to build generated code that it uses for execution. (Embedded MATLAB block uses some Stateflow-based infrastructure).
Justin
2011년 8월 20일
Kaustubha Govind
2011년 8월 22일
Sorry, I've run out of ideas with this. I would recommend contacting Tech Support to see if they can help. Good luck!
Justin
2011년 8월 22일
Kaustubha Govind
2011년 8월 24일
Justin: One other thing - have you run "mex -setup" on your R2011a installation? It appears that this issue happens sometimes when you have a stale mexopts.bat files that R2011a is picking up.
Stephen
2011년 9월 30일
0 개 추천
I had the same problem Justin did, but Kaustubha Govind's suggestion to run "mex -setup" solved the problem for me when I upgraded from Matlab R2010a to R2011a.
Roque
2014년 2월 8일
0 개 추천
I had the same problem, getting an error message that says:
'Error using ==> targetman>throw_make_error at 588 (SLSF Diagnostic)'
In my Simulink system I was using the Simulink Block "Matlab Function". I replaced that block with the "Interpreted Matlab Function" block and it worked perfectly.
I hope that this help.
Regards, Roque
카테고리
도움말 센터 및 File Exchange에서 Simulink Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!