LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variant Array Problem

Hello,

 

I am having a problem with variant array conversion.

A VI gets a 1D array of generic data type as variant. This VI generates a 2D array of this and passes this to a third VI which has to write that data into a 2D array by the "Value" Property as variant of a control element.

I somehow cannot convert the 1D array of variant into a 2D array of data.

 

I can demonstrate it with a simplified VI that is demonstarting the problem.

VaraiantArrayProblem.PNG

 

I hope someone can help me out.

0 Kudos
Message 1 of 12
(4,024 Views)
0 Kudos
Message 2 of 12
(4,020 Views)

You cannot directly convert an array of variants (of 1D arrays) to a 2D array. "Variant to data" accepts a variant, not an array of variants.

 

What are you actually trying to do with all this?

0 Kudos
Message 3 of 12
(4,003 Views)

You have a 1D array of variants.  This'll get your 2D array back.

 

VariantArrayProblem[1]_BD.png

 

Or, move the To Variant node to the inside loop.

 

VariantArrayProblem[1]_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 4 of 12
(3,998 Views)

...or, to the outside of both loops.

 

VariantArrayProblem[1]_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 12
(3,981 Views)

Sorry, my example doesn't reall describe what I need to do.

I created a new example. The VI architecture is fixed and the data generated by Sub 1 is generic. It can be numeric, string, bool..

 

I nned to be abl eto write the 2d array by reference to the control and hope somehow to do it without another conversion step.

 

Thanks

0 Kudos
Message 6 of 12
(3,971 Views)

Somehow cant attach zip files

Download All
0 Kudos
Message 7 of 12
(3,970 Views)

Your first problem is that you want to put a string into a numeric indicator.  That's not gonna work.

 

A smaller problem is the way you're putting the array of variants into another variant in sub 2.  This works if you change the False constant to True in sub 1:

 

sub2_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 8 of 12
(3,937 Views)

Jim

sorry for the confusion with the boolean constant. It was meant to write the numeric values.

 

I found a workable solution for me. It works, when scalar valuse are converted to variant and then arrays of variant are built.

Download All
0 Kudos
Message 9 of 12
(3,926 Views)

How are you going to handle this?

 


@DAckermann wrote:
[...] the data generated by Sub 1 is generic. It can be numeric, string, bool [...]

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 10 of 12
(3,907 Views)