LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I subset an array (from excel) by time values for length?

Hi NIquist,

 

what were your thoughts on how to use the seconds column? Do you know of a way to use that for segmenting out 600 seconds at a time sequentially? I suppose if it were possible that way as well, I could just use the timestamp associated with the last row of each portion (i.e. seconds 1-600-->use timestamp associated with the 600th second and 601-1200 use the 1200th).

 

Thanks

 

 

0 Kudos
Message 11 of 18
(1,383 Views)

If you don't convert the time stamps, you can use a for loop to read through the elapsed times to determine if it has been 10 minutes and then subset that data to a 3-D array.  I have attached an example that hopefully explains this.  It is untested but should give you a good starting point.

 

Also, your subVIs still didn't get attached in the ZIP file.

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 12 of 18
(1,355 Views)

Hi Alex,

 

This sounds great. I think you forgot to attach your example.

 

Thanks,

 

0 Kudos
Message 13 of 18
(1,348 Views)
My apologies.  Attachment now actually attached 🙂
Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 14 of 18
(1,341 Views)

So is the first dimension (page) each instance of ten minutes worth of data?

 

I have attached the VI that you have sent with an added array for testing. Also is another VI that I will use to try and parse out Cycle counts from the 2D array of each 10 minute portion.

 

0 Kudos
Message 15 of 18
(1,333 Views)
Yeah, each page should be 10 minutes of data.  I realized my code had one problem in that it was not including the last set of data.  The attachment has the fix.
Alex Person
NI-RIO Product Support Engineer
National Instruments
Message 16 of 18
(1,325 Views)

Great job! I noticed the last page issue as well, but i just changed the lookup value from 600 to 599 because i noticed that the first page had actually captured 601 seconds worth, due to the non sequencial sampling rate (of the written data) changing to 599 seemed to open up that last page (I think because each iteration it was looking for "at least 600" but was getting more, which shaved the last portion by just enough to not equal 600, which left the last portion out. I will look at your modification a little more to see what you did, but it looks like you simply added another index of array and re-entered the initial 2D back into the 3D array. Very cool, thanks for the help.

0 Kudos
Message 17 of 18
(1,315 Views)

That makes sense, the off by one errors are definitely easier to see with some testing.  You're exactly right on the change.  I realized we were exiting the for loop after having found the last index but before adding the last set of data onto the 3D array.  The change just made sure to include all data.

 

If you find anything else that seems off in the code, let me know.

Alex Person
NI-RIO Product Support Engineer
National Instruments
Message 18 of 18
(1,291 Views)