LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
johnsold

Allow creation of Array constants from predefined numerical and string constants

Status: New

I would like to be able to create BD array constants from the predefined string and numeric constants.

 

Presently you cannot create an array constant by dropping a predefined constant into an empty array box on the BD.  Arrays of string constants such as Carriage Return, Line Feed, Tab, and Space need to be created programmatically using build array or manually using the '\' codes or hex codes.  Arrays created in such a manner do not have the graphical indications of what is contained.  Some of the constants (Space) are actually VIs, which may complicate things for NI.

 

Similarly the Math and Science constants like pi and e should be allowed to be dragged to an array of DBL.

 

Lynn

Arrays from constants.png

 

 

4 Comments
Darin.K
Trusted Enthusiast

A very good place to start.  I would not mind if all constants had a normal view (ie. value) and an icon view. The predefined constants become normal constants with a spiffy NI-supplied icon. Now there would be no distinction and all constants could be droppable.  Array restrictions may require all of them to be viewed as icon or all as value.  As a bonus, constants used for typing purposes (like type cast) could show their type instead of meaningless value.

 

At the very least, when you drag one of these constants to an array you should get the corresponding constant that is droppable.  For example, if you Create Constant from pi you get a normal DBL (or SGL/EXT) constant with value 3.14159.  Perhaps the drag/drop operation could automatically create the constant and drop that instead.

altenbach
Knight of NI

(Creating a constant from an indicator already creates a constant with the same data. maybe the formatting of the indicator should be retained for the constant (e.g. \codes for strings, SI format for numerics, or whatever there is... etc.))

 

I don't think dragging one of the constants into an empty array container should retain the specific values, but just generate generic array elements of the same datatype.

 

 

TCPlomp
Trusted Enthusiast

The issue with this is that it implies something, being that these specific values (pi for instance) is used in calculation like it's a variable not a floating point value.

For instance if we calculate 10*pi were not having the exact value of 10*pi, but a calculation 10 times the best numerical approach of a 64-bit floating point number of pi.

If you want that you would need to use symbolic math languages and tools (maple, mathlab et al.)

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
jgcode
Active Participant

A few times I have wanted to drop globals in arrays as well... so this idea interests me 🙂

 

Globals in Array1.png

 

Certified LabVIEW Architect * LabVIEW Champion