From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-24-2012 02:51 PM
Hello
I want to read real numbers from a text file and put them in an array.
The problem is the precision of the number is not shown. It is converted to integer.
There is a similar example at http://forums.ni.com/t5/LabVIEW/Text-string-to-integer-array-with-keeping-order-in-text-string/m-p/1...
I could not manage to transfer the number in the string array into the numerical array.
Thanks in advance.
Mittani
Solved! Go to Solution.
02-24-2012 02:59 PM
If you don't want to convert to integers, why are you using that function? Make sure you have Context Help turned on and look at the other conversion functions. There is one that will do exactly what you want.
02-24-2012 03:01 PM - edited 02-24-2012 03:01 PM
02-24-2012 03:43 PM
Thank you guys for your quick answers.
Dennis; that vi was my starting point. I turn on the help options usually.
This time I truned off the system decimal point in frac/exp string to number, and it works:)
02-24-2012 05:22 PM
Hi again,
I tried to take sub arrays from the array which contains fractional numbers.
Did not work and I got integers again.
Any suggestion?
02-24-2012 05:25 PM
Your indicator is of integer data type. Right-click a number in the array to change the representation to DBL.
02-24-2012 05:36 PM
Thank you:)
02-24-2012 08:47 PM
Mittani HD wrote:I tried to take sub arrays from the array which contains fractional numbers.
Did not work and I got integers again.
... or simply right-click the indicator and select "adapt to Source". 🙂
In any case your while loop is quite convoluted code. Since the number of iterations can be determined before the loop even starts, a FOR loop would be more correct.
Why do you think you need to get the array size with every iteration of the loop? The result never changes! This operation belongs before the loop. (of course the compiler might move it there behind the scenes as loop invariant code anyway ;))
What exactly is the loop supposed to do? Maybe you could just reshape into a 3D array and autoindex at the loop boundary to get the desired slices. Can you attach your code?
02-25-2012 01:55 PM
Yes, Altenbach, array size should be outside of the loop, and for loop can be applied.
In fact it should be 3D array. The large 2D file is capacitance measurements which are taken every 20ms.
I think taking subarrays from the large array by a for loop is easier (?).
This subarray is multiplied by a sensitivity matrix to create a 32x32 image.
This is the whole story.
So far I could not create a meaningful image.
Working on it:)
02-25-2012 05:06 PM - edited 02-25-2012 05:07 PM
Mittani HD wrote:This subarray is multiplied by a sensitivity matrix to create a 32x32 image.
This is the whole story.
So far I could not create a meaningful image.
Working on it:)
This cannot be the whole story. Currently you have 11x11 subarrays and I don't quite understand how this should translate into a 32x32 image after multiplication, especially since your sensitivity matrix is 66x812 elements????
Please explain what you mean by "image". Currently we a dealing with arrays, right. You could send the subarrays to an intensity graph to display as an image, but it is not clear if that's what you want.
Here is a quick draft how you could reshape to a 3D array, then play back the slices in a FOR loop. Right now I simply multiply with the oversized sensitivity matrix, but I doubt that's the right way.
(Regarding your program: Please get rid of the sequence structure and local variable. None are needed. The sequence structure just breaks dataflow and make the program hard to read and debug. The local variable causes additional copies of the array data in memory and there is absolutely no need for it. This is not text based code. The data lives in the wire, not in controls or indicators. After debugging, you could even delete the string indicator and the first array indicator, because they are not really needed.)