LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

approximate day

Solved!
Go to solution
hello, i was wondering if someone can help me.
i am working on this data graphing program.
my program is graphing xY graph, x is for the days and Y is for the pressure in mmHG.
My test runs for number of days and when it end, the user manually end it.
i have calculated the end day and know how to get that.
i want to know the slope of my end day vs 14 days ago or 28 days ago.
I know how to do that, but i am having problem trying to figure out all the elements that fall into days 14 days ago...i need to get all the elements and take the average of that...


for example. my end day is 300.33 so 14 days ago is about 280.20. (My program find the closest value to 14 days ago)

I want to take the average of all 280.20 day values and using that to find the slope against my end day. i hope that is clear.

can someone please help me?
thanks in advance
MERRY CHRISTMAS AND HAPPY NEW YEAR!

Best regards,
Krispiekream
Download All
0 Kudos
Message 1 of 16
(4,534 Views)
Timestamps are in seconds. 14 days = 14 * 24 hours = 14 * 24 * 3600 seconds. You need to find the point closest to the last timestamp - 1209600 seconds. And determine the actual time difference between those point in seconds. Calculate the slope per second and multiply by 3600 to get the slope per hour. Or calculate the means of each hour in the 14 days and calculate the slope of that. In the end its up to you to determine the algoritm to use.

Don't round the timestamps until the final answer is calculated.


Message Edited by andre.buurman@carya on 12-20-2007 10:01 PM
Regards,
André (CLA, CLED)
Message 2 of 16
(4,493 Views)
thanks for the help. i am not quite sure how it works though. do you have any diagram you can show me.
Best regards,
Krispiekream
0 Kudos
Message 3 of 16
(4,431 Views)

Hello,

Can you please clarify the problem?  You have stated that you are "...trying to figure out all the elements that fall into days 14 days ago...".  When using an XY Graph, you must specify the X-Y pairs; thus, by definition, you know the x-axis value (time stamp) for each pressure measurement plotted on the y-axis.  You also said that you "...have calculated the end day...", so I assume you have the final time stamp.  Knowing the final time stamp and knowing the time stamp of each point that you have plotted, you should have all the information you need.  Please let us know where you are getting stuck so that we can help you.

Best Regards,
T. McCarty
Applications Engineering

P.S. - For an example of how to use XY Graphs, please check out the XY Graph.vi shipping example found in the NI Example Finder.   

Message 4 of 16
(4,395 Views)
let me try to do this with excel.
i have my end day is 179.33
and 14 days ago. my closest value to 14 days ago is 159.25
so knowing that. i have about 158.25 days to 159.25 days to take the average data.
and having the excel file with me.
i have calculate that within that time frame. i have 158.88 days
would be the average of my 14 days ago

i just dont know how to put it in labview my concept.

158.8846
158.8846
Best regards,
Krispiekream
0 Kudos
Message 5 of 16
(4,385 Views)
Hey krispiekream,
 
I am having a problem understanding what you are trying to accomplish.  If I understand the last post you have made, you are looking to average the data between 158.25 and 159.25.  If you know how many data points you have, you should be able to loop through values, sum them, and divide by the number of values you have.  I'm not sure if I am answering your question correctly, so feel free to attempt to clarify the problem further.
 
Are you attempting to gather data over all these days?  Do you have long stretches of time where you are not collecting data?  How are you storing the data in LabVIEW?
 
Have a great weekend!
 
Regards,
 
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer
Message 6 of 16
(4,327 Views)
krispykreme,

I think I understand your question, but I just wanted clarification on one part:

In your previous example your current day is 179.33.  That means that 14 days earlier would be 165.33, but since you don't have any data for that day you look for the next closest reading, which is 159.25, and look at all data within a day of that (back to 158.25).  Supposing that you had data starting at 167.74 (less than 2 weeks ago, but closer to it than 159.25 is), would you instead want to take data from 167.74 to 168.74?  Basically, are you looking for the day that day that is "closest to 2 weeks ago", or "the closest day that is at least 2 weeks ago"?

Also, supposing that there WAS data available for exactly 14 days ago (165.33), would you then want to take data from 164.33 to 165.33?  Or 165.33 to 166.33?  Or 164.83 to 165.83 (half a day before and half a day after that 14 day marker).

Regardless of the specifics, it's going to come down to searching through the 1D array of days and looking for the closest value, then taking a subset of all elements within 1 day of that value.  I may be able to help work out some sort of implementation, but I'd need the answers to my above questions first.

Have a great weekend!
Message 7 of 16
(4,309 Views)
Hi waterlooSPEED,
I think you got my concept. my program is currently looking for 179.33 - 14 = 165.33, if i have data for that day, i would take the data for that day, but since i dont, my array currently have 159.25 so that would be the closest value to 14 days ago. surpose that i have ALL DATA FOR EVERYDAY OF THE WEEK. i think taking the half and half a day would be best?
"closest to 2 weeks ago"
i already know how to get to the closest 14 days. all i need to know how to do is to take +1 or -1 from the day that I found and take the average of all the data VS the end day (179.33).
I hope that help.
You have a great weekend too! thank you!




Message Edited by krispiekream on 01-04-2008 07:29 PM
Best regards,
Krispiekream
0 Kudos
Message 8 of 16
(4,297 Views)
Solution
Accepted by topic author krispiekream
Hi krispiekream,

This is waterlooSPEED (I submitted my previous post from home, and I guess I wasn't logged in onto my NI account!).

I made up an example program that shows how to get a subset of your day and pressure arrays.  This subset will include all data within one day of the closest day to the desired day (14 days ago, 28 days ago, or whatever).  I didn't do the "half a day before, half a day after" thing because I thought about it and I think it makes more sense to just take values a day before the desired day.

You can call this sub-VI in your program by providing iput arrays for the days and the pressures, as well as a value for the desired day (ex. 165.33) and the index for the day that is closest to the desired day (you mentioned in your previous post that you knew how to find that).  The output of the VI will be arrays for the day and pressure that include all values that fall within the closest day.  You can then take the average of these values or do whatever you like with them.
Message 9 of 16
(4,250 Views)
WOW, THANKS!
This is exactly what I am looking for. Thank you so much!

Best regards,
Krispiekream
0 Kudos
Message 10 of 16
(4,234 Views)