11-30-2018 04:44 AM
Hello everybody,
is it possible to create array functions that can handle any data type inside the array, like the NI-Array functions do? The output data type would always adapt to the input type. Like this it would be possible for example to create a function that returns the 1st array element, no matter what type it is.
Solved! Go to Solution.
11-30-2018 07:10 AM
As of LabVIEW 2017, we have Malleable VIs. Just save your VI as a vim, make sure it is set to be inlined and reentrant, and then you are good to go. There are a who bunch of functions that were released from 2017SP1 and 2018 you can use as examples.
11-30-2018 08:07 AM
All right. Sounds like for me using LabView 2015 there is no solution.
11-30-2018 08:35 AM
Sure, just make all VI's as Variants. 😄 Ofcourse you'd have to convert it afterwards to get your data back ...
/Y
11-30-2018 08:44 AM
Is polymorphic vi available in 2015?
http://zone.ni.com/reference/en-XX/help/371361P-01/lvhowto/using_polymorphic_vis/
11-30-2018 09:44 AM
@Frozen wrote:
Is polymorphic vi available in 2015?
http://zone.ni.com/reference/en-XX/help/371361P-01/lvhowto/using_polymorphic_vis/
Polymorphic VIs have been around for a VERY long time. The problem with them, though, is you have to actually define a VI for each possible data type you want to support. VIMs are a single VI that adapt to the input data type.
The other option, not exactly supported, is to make an XNode. For more details, I recommend you visit lavag.org.
11-30-2018 09:45 AM
Create -> New... -> Polymorphic VI
You'll need to create a VI for each datatype that you want to support.
11-30-2018 10:15 AM - edited 11-30-2018 10:19 AM
@timeDelay wrote:
All right. Sounds like for me using LabView 2015 there is no solution.
2015 will run a vim you will need to create it in 2017 or later and backsave for 2015 (This is not guaranteed to be bug free if you need a Type Specialization Structure but, you probably don't)
11-30-2018 10:36 AM
@JÞB wrote:
@timeDelay wrote:
All right. Sounds like for me using LabView 2015 there is no solution.
2015 will run a vim you will need to create it in 2017 or later and backsave for 2015 (This is not guaranteed to be bug free if you need a Type Specialization Structure but, you probably don't)
It won't adapt like the OP wants. It will just run as a normal VI. I know because I did this with a LabVIEW 2016 VI.
11-30-2018 11:01 AM
@timeDelay wrote:
Like this it would be possible for example to create a function that returns the 1st array element, no matter what type it is.
This function is called "index array", but unfortunately you get the first element for 1D, first row for 2D first plane for 3D. etc. Since you seem to want only the first scalar elements (assuming memory order), the code will depend on the number of dimensions and you would probably need the type specialization structure and LabVIEW 2017+.
What is the practical use of that function? Why do you need it and why isn't it sufficient to just use index array with a zero wired to all indices?