LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find zeros in a spred sheet file

Solved!
Go to solution

I have a spread sheet file having 33 column I want to find  is there any zero in any of the columns,how this can be done easily.searching one dimensional array is time consuming since file size is very large

 

 

thanks for your time

 

 

regards

augustin

Certified LabVIEW Developer
0 Kudos
Message 1 of 11
(3,216 Views)
Solution
Accepted by mjaugustin

33 columns by how many rows?

 

What do you want to do when you find it?  Do you just want to know there is one, or do you want to know where it is?

 

You could do a multiply array elements from the Numeric palette.  If the result is zero, then you know you've got one.

Message Edited by Ravens Fan on 04-21-2010 10:59 PM
Message 2 of 11
(3,212 Views)
I like Ravens Fan's solution, but you could also take the absolut value of the entire array, get the minimum, and then compare it to 0.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 3 of 11
(3,200 Views)

If the spreadsheet file is a text file, you could use the string functions to search for the presence of zeros.  The details would depend heavily on the format in which the data is saved.

 

For working with numeric values another caution is in order.  In this case it probably would work to use the Is Equal to Zero comparison primitive, but remember that in general equality comparisons on floating point numbers are not a good idea due to the finite representation in binary and roundoff errors after calculations.  Adapting Matt Bradley's suggestion you might test whether the absolute value is less than some tolerance, such as 1e-6, rather than zero.

 

Lynn 

Message 4 of 11
(3,179 Views)

johnsold wrote:

If the spreadsheet file is a text file, you could use the string functions to search for the presence of zeros.  The details would depend heavily on the format in which the data is saved.

 

For working with numeric values another caution is in order.  In this case it probably would work to use the Is Equal to Zero comparison primitive, but remember that in general equality comparisons on floating point numbers are not a good idea due to the finite representation in binary and roundoff errors after calculations.  Adapting Matt Bradley's suggestion you might test whether the absolute value is less than some tolerance, such as 1e-6, rather than zero.

 

Lynn 


Lynn- good point! but use abs val and compare to the machine epsilon  (that "little e" constant on the numeric>constants sub-palette is the smallest value that the computer can represent as a dbl) Smiley Wink


"Should be" isn't "Is" -Jay
Message 5 of 11
(3,176 Views)

Jeff,

 

If the data is being read from a spreadsheet, the tolerance need not be smaller than the resolution in the file.  I agree that machine epsilon is universal.

 

Lynn 

0 Kudos
Message 6 of 11
(3,173 Views)

hi

Thanks for the reply

No of rows will vary

I want to know where it is also

Certified LabVIEW Developer
0 Kudos
Message 7 of 11
(3,131 Views)

hi

Thanks for your reply,your solution works if only one zero is there if multiple zeros are there how i can find the position of those

Certified LabVIEW Developer
0 Kudos
Message 8 of 11
(3,130 Views)

mjaugustin wrote:

 

searching one dimensional array is time consuming since file size is very large

 

 


If you are going to need the positions of the 0's then you are going to have to search. All the above examples where for quickly assessing if there where any 0's present. I would ascertain first, using the above examples, whether you have any 0's. If you do then search for them.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 9 of 11
(3,099 Views)

Just a thought.  Why not look for 0 when you are building your spreadsheet file.  Flag it there.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 11
(3,088 Views)