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.
You said the inputs to your DLL were all arrays, but you're passing in just one value to the "To .NET object" VI. Are your inputs actually just a single number each? If they're actually arrays, then you have to pass in a single-element array just like in the picture to get it to create an array.
Also, can you confirm the exact type that the inputs of your DLL are? If you have the context help enabled and hover over the wires leading from the constant to the conversion node, and screenshot that context help window, that would do it. Sometimes class names are long and you have to stretch out the context help window to see it all.
Or, just post the DLL and we can help a lot more...
I hadn’t seen that before. But now that I have, I still don’t know specifically what to do in Labview to successfully call the functions in my .NET assembly. Any suggestions?
Frankly we're guessing without the assembly. Please post it if you need more specific advice. Don't worry, we won't judge.
Tip1 : When exporting a .NET assembly from MATLAB , you can also have the Native DLL Generated. Else you have to use the MWArray Datatype instead of the regular VariantDatatype.
Using the MWArray Dayatype - Using the MWArray.dll ( found in the MATLAB runtime folder ) .you can create the Array types as refs and then pass them to your .NET Call.
In attachment is a "redacted" of a current implemented .NET dll
Thanks. So I wrote a simple "Hello World" function in MATLAB that adds x and y with a single output z, then generated a .NET assembly containing the function "Rogue_sum". I found the MWArray.dll buried in the root directory of MATLAB, and used it to create this LabVIEW code. It runs without error, but the output is some HEX string I don't know how to parse. How do I read the output? Do I need to invoke something from the MWArray dll? Can you please show the output side of the example you provided? I figure if I can get this working I should be able to figure out how to call the actual MATLAB functions I'm working with.
Because we are not using the native .dll the return value is also mxarray ( and not a .net variant ). So use method of MxArray to get the correct value type. Monday I can post an actual example
Unfortunately , the .NET I used did not return any value for me to decode. But the datatype is MXArray .
So any property or method node should work. I tried an to make an example of how to convert to the scalar value , but you have to try and see if it works. ( I could not test it yet )
Your last post was very useful. I used your approach to construct a working VI for the simple "Rogue_sum" test function, and I think I can now generalize the approach to all of my actual MATLAB functions. Thank you!