LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DBL to I32 Conversion

Hi

 

I am new to Labview. In my simple project, I need to change some indices of an array.

For example, the input array is all-zero array of size of 10. I want to change value of its 0, 3, 6 and 9 entry to 5. Thus at the output we have [5, 0, 0, 5, 0, 0, 5, 0, 0, 5].

 

question_bd.png

 

To set new values to specific indices of the input array, ‘Replace Array Subset’ module is used as seen in the figure above.

Index port of this module requires value of type I32. My problem is how to change the existing type of double to I32.

 

The Project file (in version 2017) is attached.

Could you pls help me?

Regards

 

0 Kudos
Message 1 of 4
(4,325 Views)

For example like this:

dbl2i32 thol.png

Certified LabVIEW Architect
0 Kudos
Message 2 of 4
(4,311 Views)

Have you noticed that LabVIEW color-codes numbers, and codes scalars and arrays by the width and appearance of the wires?  You can change a Dbl constant of 3 to an I32 constant of 3 (which will change it from Orange to Dark Blue) by right-clicking the Constant and choosing "Representation" from the Drop-down Diagram.  You can choose Dbl, various sizes (bits) of Integers, signed (Ixx) and unsigned (Uxx), and a few others.  Note that when you create a numeric Control or Indicator on the Front Panel, by default you'll get a Dbl (which will be Orange on the Block Diagram), but you can also use the right-click/Representation method to change them to, say, I32 (which will also change the Block Diagram representation to Dark Blue.

 

Bob Schor  

0 Kudos
Message 3 of 4
(4,290 Views)

To clarify, the cause of your error is that you tried to connect an array to a scalar input.

Certified LabVIEW Architect
0 Kudos
Message 4 of 4
(4,259 Views)