05-21-2012 12:29 AM
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
05-21-2012 12:33 AM
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.
05-21-2012 12:50 AM
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?
05-21-2012 01:04 AM
@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?
05-21-2012 01:10 AM
Just! number array to number conversion
05-21-2012 01:17 AM
@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.
05-21-2012 02:45 AM
Hi Danil,
could you please explain your example?
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:
05-21-2012 08:31 AM - edited 05-21-2012 08:37 AM
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?
05-21-2012 08:47 AM
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.
05-21-2012 09:02 AM - edited 05-21-2012 09:04 AM
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...