LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fill array with multiple data types

HI!

I am making a project were I should fill matrix with selected data type, but I have problem with selecting different data type.And this will be a part (subVi) for matrix project.

Firstly I made a case structure, but there is a problem with case output terminal, because it returns only one data type.Case structure

The second one was polmorphic VI, where I made case structures for all data types (similar in picture above), but it didnt work how I wount, because user should set only matrix type not change some properties in code.

 

I know that it is maybe very easy, but please help me, because I have no more ideas how to do this.

 

Andy
Download All
0 Kudos
Message 1 of 7
(2,352 Views)

Hi enapolo,

 

you can't change the datatype of an output at runtime. It will be fixed while editing and is determined by the "biggest" datatype is has to take.

 

Please don't mix "array" with "matrix". LabVIEW distinguishs between them as "matrix" is used for special math functions, whereas "array" can be of any type and dimension!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,349 Views)

But how for example in add function we can get in output different data type?

Andy
0 Kudos
Message 3 of 7
(2,327 Views)

Hi Andy,

 

first you should note I can't open your due to it's LabVIEW version...

 

Second: your case structure output tunnel can only have one datatype. The datatype is determined by the "largest" datatype inside the case structure wired to it. You cannot change the datatype of a wire/control at runtime!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(2,321 Views)

LabVIEW propigates the data type behind the scenes for most primitives (like Add)  during the compile process.  In order to get there the compiler must be taught how many different data types the primitive can handle.  You can't change the compiler to teach it new tricks for your vi. 

 

Polymorphic vis can behave sort of like the primitives but the data type must still be known and static at run time.

 

With LVOOP and dynamic dispatching you can create methods to operate on differnt data types and select the data type at run-time.  There is a lot of good information in the LabVIEW help file about LVOOP.


"Should be" isn't "Is" -Jay
Message 5 of 7
(2,318 Views)

Hi GerdW,

 

I add a new file. Yes, I know that it returns the largest data type, maybe You have some ideas how to solve this problem in another?

 

Thank you for your help and your time. Its really important for me.

 

Andy
0 Kudos
Message 6 of 7
(2,314 Views)

Hi,

Thank you I will look about LVOOP.

Andy
0 Kudos
Message 7 of 7
(2,309 Views)