08-24-2009 03:14 PM
Hi There,
In my labview program i am analyzing a spreadsheet. I am wondering, is there a way to find blank cell in spreadsheet and fill it with some number like 0 or 1.
Thanks
yogesh
Solved! Go to Solution.
08-24-2009 03:19 PM - edited 08-24-2009 03:23 PM
If the spreadsheet was tab deliniated, you could write a program that reads the text, and searches and replaces two consecutive tab delimiters with what you wanted. Search and replace "\t\t" with "\t0\t"
To catch every case (blank cells at the beginning and ends of rows) you would want to do the same with \r\t and \t\r where \r is the return carrage character (dont remember exactly what that is at the moment)
This method would be reading from the file with the "read from text file" vi not the read from spreadsheet.vi by the way
08-24-2009 03:42 PM
I am trying this. But "search and replace substring" function is replacing every cell value to zero. Is there a better way to do this?
Thanks
Yogesh
08-24-2009 03:50 PM
Never mind. Replacing it with "search and replace pattern" did the trick.
Thanks
Yogesh
08-24-2009 03:58 PM
Many issues here, two jump off the page. First, since your spreadsheet is already in the form of a numeric array, you have lost information about the location of blanks. The 2D array will be padded with zeros, probably in ways you would not like. Second, searching for an empty string will always produce a hit and will end up with your blank value being inserted to the beginning of the string. You will never receive an empty string from the number to string conversion.
As the previous poster alluded to, you should probably go back to the text version of the spreadsheet and look for doubled up delimiters.
Having seen your "solution" I will comment that switching to that VI just means that you no longer get a hit with the empty string, and it basically is doing nothing.
If you consider zeros to be blanks (not usually a good idea IMO), then you should change your search string to 0.00000