Filter löschen
Filter löschen

How to distribute app that uses MATLAB Engine for .NET

5 Ansichten (letzte 30 Tage)
Omar Kermad
Omar Kermad am 1 Feb. 2023
Beantwortet: Shubham am 5 Apr. 2023
I'm trying to migrate from the MATLAB COM Automation Server to the new MATLAB Engine, but have run into a number of issues. The first is related to the DLL dependencies. The required DLLs (MathWorks.MATLAB.Types.dll and MathWorks.MATLAB.Engine.dll) are not registered with the GAC. If we distribute our application to users, are we supposed to include these DLLs with our application? If so, will they continue to work with newer releases of MATLAB?
I also encountered an issue where I'm not able to reconnect to a shared MATLAB session using MATLABEngine.ConnectMATLAB(name). The function call hangs and eventually throws an exception if I disconnect (by disposing the previous MATLABEngine instance) and then try to reconnect.

Antworten (1)

Shubham
Shubham am 5 Apr. 2023
Hi Omar,
Regarding the DLL dependencies, it is recommended to include the required DLLs (MathWorks.MATLAB.Types.dll and MathWorks.MATLAB.Engine.dll) with your application to ensure that it can be run on target machines that do not have MATLAB installed. These DLLs are part of the MATLAB Engine API for .NET package and can be distributed freely with your application.
As for compatibility with newer releases of MATLAB, the MATLAB Engine API for .NET package is backward compatible. This means that your application should continue to work with newer releases of MATLAB as long as you use the appropriate version of the MATLAB Engine API for .NET package.
Regarding the issue with reconnecting to a shared MATLAB session, it is possible that the previous MATLABEngine instance has not been fully disposed of before attempting to reconnect. Make sure that you call the Dispose() method on the previous MATLABEngine instance before attempting to create a new one. Additionally, you can try setting the Timeout property on the MATLABEngineOptions object to a higher value to see if that helps resolve the issue.

Kategorien

Mehr zu Call MATLAB from .NET finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by