From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI with adapt to type input

Solved!
Go to solution

Dear all,

 

I have a Call Function Node with an adapt to type input that allows me to pass a cluster without taking care of the type of data contained. So far this works perfectly but I would like to place this Call Function Node inside a subVI together with some other necessary code to re-use them.

 

The problem is that I don't know how to connect the Call Function Node to the input subVI input and with a non-dependant datatype. Similar to void dataype in C.

 

I would appreciate any input on that.

 

Thank you!

0 Kudos
Message 1 of 6
(4,367 Views)

If you have LV2017, use a VIM file! 🙂

 

These a VI files with a different extension (.vim) and some additional requirements (they must be inlineable, re-entrant VIs). Then, any inputs you pass that don't break the code are allowed.

 

If not, you can try using a variant, but I don't know if/how well that would work. You can use Variant To Data without wiring a data-type, but only if the place it is connected to defines the datatype, so that probably wouldn't work. As a result, your success would depend probably on being able to directly wire the variant data.


GCentral
0 Kudos
Message 2 of 6
(4,364 Views)

Thank your quick response.

 


cbutcher escribió:

If you have LV2017, use a VIM file! 🙂

 

These a VI files with a different extension (.vim) and some additional requirements (they must be inlineable, re-entrant VIs). Then, any inputs you pass that don't break the code are allowed.


I am currently using LV2015 but I can update to LV2017 if it is the only option. I never heard of that but I will have a look.

 


cbutcher escribió: 

If not, you can try using a variant, but I don't know if/how well that would work. You can use Variant To Data without wiring a data-type, but only if the place it is connected to defines the datatype, so that probably wouldn't work. As a result, your success would depend probably on being able to directly wire the variant data.


Using a variant was my first idea but it was almost the same, I will need to have a common point such as in the case structure output which will not work with different datatype and connect it to the Call Function Node.

Another option is to convert cluster to u8 array but it will also need to place some extra code out of the subVI because I cannot directly wire a variant to typecast function. Sending the cluster as u8 array will work for my but I neither know how to convert variant to u8 array.

 

0 Kudos
Message 3 of 6
(4,339 Views)
Solution
Accepted by topic author cgh_4

@cgh_4 wrote:

Thank your quick response.

 


cbutcher escribió:

If you have LV2017, use a VIM file! 🙂

 

These a VI files with a different extension (.vim) and some additional requirements (they must be inlineable, re-entrant VIs). Then, any inputs you pass that don't break the code are allowed.


I am currently using LV2015 but I can update to LV2017 if it is the only option. I never heard of that but I will have a look.


It is an official new feature with 2017.  Supposedly, it was a hidden feature since LabVIEW 8.5.  If you look on LAVAg, there are a few threads on "VI Macro".  The feature is now called a Malleable VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(4,314 Views)

crossrulz escribió:

It is an official new feature with 2017.  Supposedly, it was a hidden feature since LabVIEW 8.5.  If you look on LAVAg, there are a few threads on "VI Macro".  The feature is now called a Malleable VI.


After 1-day migration to LV 2017 (RT+FPGA+Drivers+etc.) I managed to test it and it works pretty well. Thank you.

My only concern is that this feature is not enabled in LV2015. Since I have one license not valid for 2015 version it can be a problem for me. So far I was quite happy with LV2015 while I have already faced some issues in LV2017.

0 Kudos
Message 5 of 6
(4,277 Views)

I was lead to believe (perhaps I misunderstood) that if you try to backsave a project containing a VIM, it might (might!) work, so long as it doesn't include the Type Specialization Structure (yours probably doesn't).

 

So if you have a 2017 computer available to write the VIM, it might be possible to backsave it to 2015, where the Xnode implementation would be used instead. I haven't tried this, but I heard it (I think - again, maybe I misunderstood) from the creator.


GCentral
Message 6 of 6
(4,269 Views)