Call matlab function from C#
조회 수: 6 (최근 30일)
이전 댓글 표시
I need to call matlab function from C# program. I recently switch to matlab 2022a (from 2019a). i got the following exeption... it worked fine with matlab 2019a.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/985135/image.jpeg)
댓글 수: 0
채택된 답변
Rishav
2023년 10월 4일
Hi Guillaume,
I understand that you are getting an exception while calling MATLAB function from C# program in R2022a.
You need to add the R2022a COM Reference in your project.
If you have added the COM reference, you need to do a registry clean up, and start from the beginning. The following command will help.
From a shell command prompt:
matlab -unregserver
It is important that you start a MATLAB with administrator rights to successfully execute the following commands:
1. Start the registered MATLAB (R2022a) with admin rights
>> comserver('unregister', 'User', 'all')
>> comserver('unregister')
>> comserver('query')
2. This should return empty
>> regmatlabserver
>> h=actxserver('matlab.application')
Also, confirm that the MATLAB server opened is R2022a and the path is correct.
Make sure to do these on a new started MATLAB and make sure all other instances are closed.
Thank you,
Rishav Saha
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!