LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading column lengths from an array

Solved!
Go to solution

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!

 

 

0 Kudos
Message 1 of 4
(1,953 Views)
Solution
Accepted by topic author notAWizard0555

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,948 Views)

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!

0 Kudos
Message 3 of 4
(1,944 Views)

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?

0 Kudos
Message 4 of 4
(1,913 Views)