03-28-2012 06:38 AM
Hello
I have a 2D array, with one column for time/date and one for data measurements. I want to specify a upper and a lower time limit, and then be able to find out how many data points that lies within this time interval. Can anyone help me with this?
Greetings
Kristoffer
03-28-2012 07:39 AM
Hi,
What I would do is to find the index where the data enters your range and the index where the data leaves your ranger, then just take a subarray out of the original array starting at the first index and going the length to the next index.
The attached vi should be a good template.
Regards,
Rob Afton
03-28-2012 08:05 AM
Hi!
Thanks for that, hoping that this can help me a bit further. Just one question, as I am calculating within a loop, and therefore the upper and lower limits will change during the looping. My data consist of both date and time, and i haven't been able to convert this into a timestamp without using the "Scan from string" vi. Any suggestion on how to solve this?:)
Greetings
Kristoffer
03-28-2012 08:15 AM
Date/Time to Seconds will return the time in seconds.
Found on the Timing palette
Ben
03-28-2012 08:57 AM
But, to be able to use that, don't I have to convert the time/date colum in the array into seconds also?
Greetings
Kristoffer
03-28-2012 09:01 AM
Yes.
Ben
03-28-2012 09:17 AM
Ok.
So, right now I have a 1D array of type string with time/date. May I ask you the easiest way to go from this and to a 1D array containing seconds?:)
Greetings
Kristoffer
03-28-2012 09:26 AM
Wire the 1d array of strings conating time and date as a string to a For loop and inside the loop foramt the time date and pass same to the Time-Date to seconds and wire the output of that to the edge of the For loop.
LV will automatically index an array on the edge to select each value coming in and will do similar on the output resulting in an array of times in seconds.
If you have trouble post an IMAGE of your code so we can advise further.
Ben
03-28-2012 09:27 AM
Wire the 1d array of strings conating time and date as a string to a For loop and inside the loop foramt the time date and pass same to the Time-Date to seconds and wire the output of that to the edge of the For loop.
LV will automatically index an array on the edge to select each value coming in and will do similar on the output resulting in an array of times in seconds.
If you have trouble post an IMAGE of your code so we can advise further.
Ben
03-28-2012 10:53 AM
Thanks!
I can see how it is supposed to work. I just have one problem, and that is connecting the timestamp output in the for-loop with the time/date converter. I have attached the code, so would be great if you could have a quick look at it.
Greetings
Kristoffer