06-15-2014 12:37 AM
Hello. I have one column of data with 530,000 rows. The only values are either a 0 or a 1 (1 represents the occurence of an event; 0 does not). I'd like to be able to determine the amount of 0s in between each consecutive occurence of 1 throughout the entire array. For example, I'd like to be able to determine the number of zeros (i.e., rows) in between the first and second 1, the second and third 1, the third and fourth 1, etc, then determine the mean. Using the Search 1D array function makes it pretty easy to do for a few occurances, but I'm having trouble figuring out how to search through all 530,000 rows. Thank you in advance for your help.
Solved! Go to Solution.
06-15-2014 01:11 AM
Here is one approch . I am not sure if this is best one.
06-15-2014 01:45 AM - edited 06-15-2014 01:45 AM
Here's an alternative version that processes it as string. 😄
Of course it takes a simulated 1D array of U8 (using the bernoulli distribution tool), but you should be able to easily prep your own array to conform to that and process it the same way. (e.g. get the column using index array and convert to U8)
(It would be more efficient to sum the sizes in a shift register and divide by the size at the end, but this should get you started)
07-08-2014 02:27 PM
Hi altenbach,
Forgive my ignorance, but implementing a Read from Spreadsheet with an Indexed Array leads to a coercion dot on the U8 function, and my output for the mean is the array size (i.e., string length). Can you tell me where I'm going wrong? I've attached an example data file I am using.
07-08-2014 02:32 PM - edited 07-08-2014 03:11 PM
MattStock1984 wrote:Forgive my ignorance, but implementing a Read from Spreadsheet with an Indexed Array leads to a coercion dot on the U8 function, and my output for the mean is the array size (i.e., string length). Can you tell me where I'm going wrong? I've attached an example data file I am using.
07-08-2014 05:58 PM
I believe I understand now. Thank you for your help.