Matlab encounters major performance issues when interfacing with .dll referencing another .dll
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am using Matlab to interface with some measurement equipment (specifically, a VNA). The equipment vendor provides us with both a .tlb file and a .dll file (let's call it Manufacturer.dll). The .tlb file references a .dll in the Global Assembly Cache, this is all correctly configured and works well (even with Matlab, actually).
In order to that it has been decided to load this Manufacturer.dll with C# and with that class library to create a subset of this .dll (let's call it VNA.dll). This allows us to interface the functions exactly the way we want it to. This VNA.dll library works perfectly well when used from C# (let's say, in another project).
Now comes the Matlab performance issue. If I load the VNA.dll within Matlab using
NET.addAssembly('Path\to\VNA.dll')
it also works well! I can see accessible methods using
methods(myObject)
or see its properties using
properties(myObject)
the methods execute properly and without error.
However, if I want to visualize (let's say I just ask Matlab to output myObject in the workspace by simply typing out
myObject
Then Matlab comes to a brutal halt, it may take over an hour to display the types referenced from the .dll library. This is troublesome, especially considering that calling a specific method is extremely fast
This is quite an issue at the moment because it slows down development "a lot" and it prevents us to navigate through the public methods and properties using the Matlab's workspace.
There are some work-arounds such as re-coding everything inside Matlab, but this prevents us from using some very useful features that C# offer, plus we have to re-code a bunch of already coded things.
Why does Matlab exhibits this behavior, and how should I go about solving this issue. I've interfaced .dll class libraries multiple times in the past and it always worked like a charm. However, this specific class library refers to a COM object. I wonder if that may be the cause, and especially wonder how to make the performances reasonable again.
Thank you very much for your help,
Jerome
1 件のコメント
Helper
2018 年 8 月 21 日
For directly executing the variable, MATLAB actually executes disp(variable). In this situation, MATLAB basically runs disp(myObject). I have tried with several .NET Assembly on my machine, but I cannot reproduce this issue.
But specifically what disp(.NET Assembly) does is show the properties the Assembly has. Since other functions like "methods" and "properties" work properly for you, then it might a workaround for using these functions instead of using disp for Assembly Object.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!