03-05-2019 08:41 AM
Hello,
I have a spread sheet of one column that gets updated with a new random number every time a button is pushed, and a second column that is has a separate number that the first random number is assigned to.
I am trying to read the column lengths of each of these columns so I can more quickly find where the next random number needs to be assigned. I assume that as long as the column lengths aren't equal, there is an unassigned 2nd column number. Before, I was going row by row in a while loop looking for the first blank space in the first column (also indicating that there is a unassigned second column number) and using that iteration number as the length. However, the spreadsheet I'm reading from is fairly long, so that method took around 35 seconds which I am now trying to optimize.
I feel like this is something really really easy and I am just having a brain fart of sorts. I have tried several different things, but my probes keep saying that they are reading the same number of lines. I have attached a screenshot of this section of the code. Any help would be awesome!
Solved! Go to Solution.
03-05-2019 08:50 AM
Hi not,
I assume that as long as the column lengths aren't equal, there is an unassigned 2nd column number.
In a 2D array all columns have the same length!
Before, I was going row by row in a while loop looking for the first blank space in the first column
What about using Search1DArray to search for "blank" elements?
03-05-2019 08:53 AM
Ohhhhhh. Yep that would make sense. The search 1D array could also be something I could do, but I'm concerned that would also take quite a bit of time. I'll test it out!
03-05-2019 10:55 AM
You have a formatted text string and once you scan it as DBL, "blank field" no longer has any meaning (it will be padded with zeroes to the longest row/column as defined by the max number of row and column delimiters in the string).
A better bet would be to convert it to a string array (usign the same tool, but with type = 2D array of strings!) and search for empty strings.
Still that entire thing does not make a lot of sense. Where does the string originate? Do you mean some columns don't have an second assigned value? How can that even happen?