Unable to execute sim command for simulation from C# .Net
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I want to pass model name from c# code to Matlab method which simulates that model and returns results. I have used MWCharArray to store model name and passed it to matlab method. I am getting exception as "Undefined function or method 'sim' for input arguments of type 'char'".
댓글 수: 0
답변 (2개)
Friedrich
2011년 7월 13일
댓글 수: 5
Kaustubha Govind
2011년 7월 13일
Alternatively, if your .NET application is running on a computer that has MATLAB installed, you can start MATLAB as a COM server to run the SIM command: http://www.mathworks.com/help/techdoc/matlab_external/brd0v3w.html
Friedrich
2011년 7월 14일
Hi,
I created an example and uploaded the C# project here
(is there any way to share files here?)
You have to modify the reference to your ML which you are using. Otherwise it won't run.
댓글 수: 3
Friedrich
2011년 7월 15일
Unfortunately there is no way around. When you like to use the ML automation server you need a MATLAB installed. The MCR won’t work here.
If your application should run on a PC without ML installed the only way is to use Simulink Coder (previously Real-Time Workshop) to generate code or an executable from your Simulink model which you can call from C#.
Using installed ML you can use the sim command.
On a PC without ML you have to “compile” your Simulink model first. Good point here is, no MCR is needed at all because you generate plain c or C++ code:
http://www.mathworks.com/products/simulink-coder/index.html
참고 항목
카테고리
Help Center 및 File Exchange에서 Manage Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!