- Add a reference to the MathWorks.MATLAB.NET.Arrays assembly in your C# project.
- In your C# code, before launching the standalone MATLAB app, you can preload the MATLAB Runtime by creating an instance of the MathWorks.MATLAB.NET.Utility.MWMCR class and calling the Initialize method. This initializes the MATLAB Runtime and reduces the subsequent launch times of the standalone apps.
Initializing MATLAB runtime from c# app
27 ビュー (過去 30 日間)
古いコメントを表示
I have a c# windows form app that launches standalone MATLAB exes built with compiler.build.standaloneApplication. However launching these exes takes quite a long time since MATLAB runtime needs to be initialized (30 seconds to minutes for some apps). Is there a way I can preload the runtime when the c# app is launched to reduce subsequent launch times of the standalone apps?
0 件のコメント
回答 (1 件)
Prannoy
2023 年 6 月 30 日
Yes, you can preload the MATLAB Runtime when your C# app is launched to reduce subsequent launch times of the standalone MATLAB apps. Preloading the MATLAB Runtime ensures that it is initialized and ready to be used by the standalone apps when they are launched.
Here's an example of how you can preload the MATLAB Runtime in your C# app:
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
// Preload the MATLAB Runtime
MWMCR mcr = new MWMCR();
mcr.Initialize();
3. After preloading the MATLAB Runtime, you can launch the standalone MATLAB app as usual.
参考
カテゴリ
Help Center および File Exchange で MATLAB Compiler SDK についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!