ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

accept array or int data type

Your pseudo code there very much describes a polymorphic VI.  A polymorphic VI can choose which VI to run based on the data type on the connector.



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 11 of 18
(999 Views)

A polymoprhpic VI as I understand it is just a group of VI's.

 

I can make a lot of generalizations in the source code

 

I.E. Float Array, Int Array (reguardles of size) will all invoke the same method (with a conversion for floats). Wouldn't a polymorphic VI mean writing a case for every single data type?

0 Kudos
Message 12 of 18
(995 Views)

Yes, a polymorphic VIs is a stack of standard VIs, and yes, a polymorphic VI will require a VI for each datatype - just like your pseudo-code requires a case for every data type. LabVIEW will automatically convert numeric datatypes for you, though, so you can wire an array of ints to a VI that accepts an array of floats (or vice versa) without having a VI to handle that specific array type.

0 Kudos
Message 13 of 18
(992 Views)

But it doesn't.

 

I can use the same case for all arrays, or all ints. Thanks to the && operator, so another question would that exist in Labview? I guess with a dynamic input it would.

0 Kudos
Message 14 of 18
(988 Views)

Valarauca wrote:

I can use the same case for all arrays, or all ints. Thanks to the && operator, so another question would that exist in Labview? I guess with a dynamic input it would.


Sorry, no idea what you're trying to say here. I've been writing a lot of C lately but not Java, and to me && is just AND (that operates on values, not bitwise). Does it mean something else in Java? What do you mean by a "dynamic input"?

0 Kudos
Message 15 of 18
(984 Views)

That's what it is.

 

I can use the same case for all array times, and integer types. I don't know how to do this in LabView.

0 Kudos
Message 16 of 18
(982 Views)

Or sorry not bitwise and

 

|| or very sorry for that.

0 Kudos
Message 17 of 18
(978 Views)

In that case I have no idea why you mentioned the && operator, I don't see it anywhere in your pseudo-code.

 

Again, LabVIEW will handle numeric conversions for you automatically. Personally what I would do is create a single VI for the temperature conversion that takes a floating point as an input, and outputs a floating point value. Voila, done! It will handle any numeric type - the conversion is automatic. If you need to handle an array, just wrap it in a for loop at that point in the code.

 

Instead of trying to make LabVIEW work like Java, accept that it's a different programming language with its own set of advantages and disadvantages that sometimes require different approaches to writing an algorithm.

Message 18 of 18
(975 Views)