How to run .net app with using matlab dll?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi, I'm using the matlab interface for .net 6, so I tried to do everything as stated here
My project file:

My Program.cs file:

When I run application an error pops up:

So I added to my project file this:

and this happening:

What did I do wrong?
댓글 수: 0
답변 (1개)
colordepth
2025년 2월 19일
The encountered "MATLABNotAvailableException" error suggests that your PATH environment variable might not be set correctly to find the MATLAB installation. Since you are on a Windows machine, make sure that the directory "<matlabroot>\extern\bin\win64" is included in your system PATH. Replace "<matlabroot>" with the actual path to your MATLAB installation, which might look like 'C:\Program files (x86)\MATLAB\R2022b'. You can find the correct path by running the "matlabroot" command in MATLAB. More details on this command are available at: https://www.mathworks.com/help/releases/R2022b/matlab/ref/matlabroot.html.
To modify your system PATH variable, follow the instructions provided here: https://www.mathworks.com/matlabcentral/answers/223482-how-do-i-set-add-or-change-environment-variables.
It seems you tried to resolve the error by directly referencing DLLs in your C# project file, which could lead to further complications. I suggest removing those direct DLL references from your project. Setting the system path is the recommended method and should resolve the issue without needing those additional references.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from .NET에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!