LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract values from .NET object?

I am completely new to LabView and C#. 

 I created an .NET assembly from MATLAB code which returns 2 array(each n x 1).  Using .NET palette of LabView, I created invoke node of class ‘Angular’ and it has several input (numArgsOut, f, etc) and one output  ‘Angular()’. I connected inputs with .NET object and numeric control. The problem is How to connect output(object) with some kind of indicator (numeric array indicator?). Because I should get 2 arrays (each n x 1), is there a way to separate object into 2 arrays?

 

Part of C# code shows as follows

 

 

public Object[] Angular(int numArgsOut, Object f, Object C_g, Object cp90, Object 

                      cg90, Object thickness, Object dp, Object d, Object NT, Object D)

    {

      return mcr.EvaluateFunction(numArgsOut, "Angular", f, C_g, cp90, cg90, thickness, dp, d, NT, D);

    }

 

 

And I suppose numArgOut should be 2. (I think MATLAB coder made this variable)

0 Kudos
Message 1 of 3
(3,634 Views)

The functions you need are probably ".NET Object to Variant" and "Variant to Data". Possibly you will need to convert the .NET object to a more specific class first, using To More Specific Class. If the .NET objects are plain data (for example numeric values) then you just wire the appropriate data type to Variant to Data and it should work. If the .NET objects are more complicated types, then it may take more work to get data out of them - for example, you may need to case them to more specific objects, then call methods on them to retrieve the data. But start with .NET Object to Variant and see if it works.

Message 2 of 3
(3,623 Views)

Thank you very much! I'll try it right away.

0 Kudos
Message 3 of 3
(3,599 Views)