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
(3,384 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
Senior Applications Engineer, NI
Certified LabVIEW Developer & TestStand Architect
0 Kudos
Message 2 of 4
(3,289 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
(3,284 Views)

If it works it's pretty. 😉

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(3,279 Views)