LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion, Please help

How do I convert "1-D (sub)array of double " [64-bit real(~15 digit precision)] to the sink type of long? (32 bit integer)............

Tried all function of array and conversion but not working...

Please help, Thanks.

 

Regards

0 Kudos
Message 1 of 21
(2,993 Views)

Did you try using the "To Long Integer" function available in the Numeric pallete. If you still have problem just post the code that you have tried.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 21
(2,990 Views)

Hi Tony,

            I have attached a simple array to number conversion example.Iam not sure if it is what you want.Please attach your VI then we can correct your issue easily..OK?

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 3 of 21
(2,987 Views)

@danil33 wrote:

Hi Tony,

            I have attached a simple array to number conversion example.Iam not sure if it is what you want.Please attach your VI then we can correct your issue easily..OK?


Hi danil33,

 

    Can you please tell me what you are trying to achieve with the example you have given?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 21
(2,982 Views)

Just! number array to number conversion

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 5 of 21
(2,980 Views)

@danil33 wrote:

Just! number array to number conversion


Is It an average , Summation or anything else?. If that is a simple number from the array you are taking means why don't you index the array and take. Upto my understanding there is no meaningful action done in that code. If I am wrong you can tell me what elase you are doing in that.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 21
(2,975 Views)

Hi Danil,

 

could you please explain your example?

check.png

 

Why do you multiply with zero? What will be the result of that operation?

Why do you add zero to the array elements? What is the purpose of that operation?

Why do you use a FOR loop just to output the last element of the array? Why not use a simple IndexArray instead?

Where do we find the DBL array the OP is talking about?

 

To the OP:

Why not use a simple approach like that:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 21
(2,962 Views)

Hi GerdW

 

Looks like it works, but when I test your solution, I input a small number, the output become very, very big. Why is that so?

0 Kudos
Message 8 of 21
(2,940 Views)

Hi P Anand

 

I'm trying to extract data from excel file ( which is 1-D array of long) ,(one number at a time, not a row) to trigger a case structure. Even I use "to long integer" it says the format is 1-D array of long integer. So I need to convert that specific number in 1-D array form to integer.

 

Sorry it would be really hard to post code because my code is huge and messy and hard to tell you which part.

0 Kudos
Message 9 of 21
(2,932 Views)

Hi tony,

 

in your example from message #8 you calculate the average of an empty array, which results in NaN as you easily see by using probes. NaN is converted to max of I32 which is 2^32-1...

 

For message #9: Either use an autoindexing FOR-loop or IndexArray...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 21
(2,923 Views)