04-11-2012 04:05 PM
I have a 2D array with values. The array comes from a set of calculations. Unfortunately LabView creates a strange value once in each column (it puts in the value -3,41418E+9 once in each column). I want to replace this value with 0 (zero). How can this be done?
Greetings
Kristoffer
Solved! Go to Solution.
04-11-2012 04:10 PM
LabVIEW isn't putting anything "strange".
You need to understand what is happening in your setup to cause LabVIEW to record this value.
Use Replace Array Subset if you want to persist in your current approach.
04-11-2012 04:15 PM
I know whats happening, just a way of typing it. Whats happening is that I am subracting a timestep from the previous, and when the column ends i puts this value instead of 0, because I am subtracting the previous value from 0, which of course becomes a negative value. Since there is different number of samples inside the columns, I haven't found a way around this problem. And because of that, I want to try this approach instead.
04-11-2012 04:17 PM
I agree, there is nothing strange about this value. Are these values always binary identical or are they just very similar?
What is a typical value of an entry that is "not strange"?
What kind of calculation is this? Can you show us your code?
Is the strange value always at the same array position or does the program need to find them?
04-11-2012 04:21 PM
@Sjefsgjogleren wrote:
Whats happening is that I am subracting a timestep from the previous, and when the column ends i puts this value instead of 0, because I am subtracting the previous value from 0, which of course becomes a negative value. Since there is different number of samples inside the columns, I haven't found a way around this problem. And because of that, I want to try this approach instead.
You are giving very little information. So, is it always the last value that is "strange"?
What prevents you from showing your code instead?
04-11-2012 04:23 PM
I would usually try to remove these from the source, but as long as the array is not huge this simple code will run in a blink of an eye. Choose the bounds to safely contain the good data.
04-11-2012 04:27 PM
Yes, they are identical. They will not appear at the same position in all columns, they appear "instead" of the first value that actually should have been a zero. (I described why in my second post). If a column has 54 elements, this number will be the 55th element. But since not all columns have the same amount of elements, it might be the 59th element in the next column.
The first for-loops (with case structure) converts my time/date from string to timestamp. The second for-loop is subtracting element n from element n+1 for all columns in the array. The last part of the code is only for deleting the last column of the array, since it is not containing a full sample size.
04-11-2012 04:32 PM
We still prefer the actual VI over a picture. We cannot run or probe a picture.
04-11-2012 04:35 PM
I have created a couple of sub-VIs, so quite some files to upload, but will do it now!
04-11-2012 04:37 PM
In the sub-VI "Powercurve_master", you probably need to delete the upper for-loop. This is just for use later in the program, so should affect at all.