LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a jagged array int[][] for a .net function?

Hello,

 

I've got to call a function from a C# library which has a function parameter of the type int[][].

Up to now I could not find a way to create such an object in LabVIEW so that it is accepted.

 

C#:

public MyClass(int[][] parameter)

 

Is there a way in LabVIEW to create a jagged array?

Have a nice day
Michael

0 Kudos
Message 1 of 4
(1,076 Views)

Hello Michael,

 

unfortunately LabVIEW does not support arrays of arrays. Therefore, you'll not be able to use a jagged C# array directly. My knowledge of C# is limited but would it be possible to split the arrays before passing to LabVIEW using a wrapper?

 

Kind regards

Andreas

Andreas Gareis
Staff Technical Support Engineer, NI Germany
Certified LabVIEW Developer & TestStand Architect
0 Kudos
Message 2 of 4
(981 Views)

Hi Andreas,

what I did now was to create a factory class in C# for which a have a function

addArray1d()

which is called several times from LabVIEW and creates within C# the jagged array.

Then I call the 

createObject() function which internally passes the now hidden jagged array to the constructor of the class and then returns the object which I can use in LabVEW. It is a workaround which is not very pretty - but it works.

Have a nice day

Michael

0 Kudos
Message 3 of 4
(976 Views)

If it works it's pretty. Smiley Wink

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(971 Views)