From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-09-2019 05:36 PM
I'm new to using .NET Assemblies in Labview. I generated a dll in Matlab, and then used a "constructor" to point to that Matlab dll. I then connect that to an "invoke node" which seems to correctly know all the inputs to the function "Setup" contained in the dll. The problem is that the inputs should be all numerical arrays and instead show up in Labview as .NET refnums which cant be wired up. The output of the "Setup" function is also several arrays, but in Labview shows up as a single output. What am I missing here?
Solved! Go to Solution.
01-09-2019 06:02 PM
Posting the .NET assembly would be helpful to give you some more pointed advice.
But from your description I can guess that parameters for the Setup function are not the Array type but of a different type such as ArrayList, IEnumerable<T> or one of the other collection classes / generic collections.
Also in .NET there are only two ways of returning information - via the reference modifiers (called "ref" and "out" in C#) or via the return value of the method. It looks like your Setup method only has a single return value but of what type I can't say without the assembly on hand.
01-09-2019 06:45 PM
You could try one or both of these options:
The "Double" and "Array" types are in the "mscorlib" assembly. "To .NET object.vi" is in the ".NET" palette.
01-10-2019 02:01 PM
Kyle,
I tried your second suggested method, but get an error message. Any further suggestion? Meanwhile I'll try your first method. I appreciate your help.
01-10-2019 02:22 PM
Kyle,
Meanwhile which "object" in the mscorelib contains the "double" and "array" constructors that you used in your first example? There is a lot in that library. Thanks.
01-10-2019 02:28 PM
Look under "System" and you will find those classes.
01-10-2019 02:34 PM
Tyk007,
All the input parameters to the "Setup" method show up as "MWArray" in the pull-down menu for selecting the method for the class. I assume this is because Matlab is a MathWorks (MW) product, and Matlab was used to create the .NET assembly. Is there something special I need to do? The Setup function in Matlab returns several arrays, and I want all of them when I invoke the method in Labview.
01-10-2019 02:40 PM
Tyk007,
I found "double in "system", however "array" is problematic.
01-10-2019 03:04 PM
If you re-check Kyle97330's post the Array is created using a static method on Array. Check that you aren't trying to find a constructor and a browsing for an Invoke node.
01-10-2019 03:06 PM - edited 01-10-2019 03:06 PM
@Rogueone wrote:
Tyk007,
All the input parameters to the "Setup" method show up as "MWArray" in the pull-down menu for selecting the method for the class. I assume this is because Matlab is a MathWorks (MW) product, and Matlab was used to create the .NET assembly. Is there something special I need to do? The Setup function in Matlab returns several arrays, and I want all of them when I invoke the method in Labview.
I'm not familiar with Matlab's .NET assembly creation functionality so I would assume that the "MWArray" type exposes some properties and methods to help you access the individual elements. Posting your .NET assembly (try zipping it) would make it easier for me to help you.