04-02-2012 08:48 AM
Hello!
I have asked quite a few questions about my problem here lately. However, after using severals of severals of hours, I still haven't been able do finish my code. I am therefore putting out my code here, and hoping that some clever brains out there can help me finish it.
What I want the code to do:
I want my code to take time 1 from the table, and add the corresponding data measurement to an array (or something).
Then I want the code to take the corresponding data measurement from time 2 an add that to the same array (or something).
I then want the code to continue doing this untill time n is above a specified upper time limit (upper time limit = time 1 + a user defined horizon)
When this is done, the program should calculate the mean for the whole array (and save that to a new array as well).
Then the code starts all over again, but this time from time 2.
This should continue all the way until the time from the new start time and till the last measurement is less than the specified horizon.
Really really hoping that someone can help me out on this one, as I really needs to finish this code soon.
If there is any questions about my existing code, or anything else, just ask.
Greetings
Kristoffer
04-02-2012 09:11 AM
Am I to understand you are unable to finish your course assignment, and you want someone else here to finish it for you?
04-02-2012 09:42 AM
04-02-2012 01:01 PM
Instead of telling us what you want your code to do and uploading a VI with a missing subVI such that we can't run it, you could be more specific about the problem you are having. Have you used any sort of debugging, such as the execution highlighting, to examine what your code is doing? Where does it fail?
04-02-2012 01:45 PM
Sorry for the missing subVI, totally forgot about it. Have uploaded that one as well now.
When it comes to beeing more specific about the problem:
Right now, the program is just taking the data measurement that belongs to time t1, and taking the mean of that (which, of course, is the same number as the measurement itself). Then, the program takes the data measurement belonging to time t2 and takes the mean of that and so on. In the end, it returns an array that is the exact same as it gets in.
What I am struggeling with is to make the inner for-loop calculate the mean for the whole time intervall [t1,t1+n] and returning that, before moving on to time intervall [t2,t2+n] and calculating the mean of that and so on.
Hope that this clear things up a bit
Greetings
Kristoffer
04-02-2012 01:57 PM
So are you looking to get an average from each colum of data?
04-02-2012 01:59 PM
I think your In range and coerce will always return true as you've wired the same wire to both lower and active input.
I think you overcomplicate things. Put the Mean outside the inner loop and you'll get the mean of the whole array. Isn't that the T1 and the next turn of the big while will result in T2?
/Y
04-02-2012 02:05 PM
Well not quite for each column, as there is one column for time/date and one for the measurements. I want the average for each time intervall, like [t1,t1+n], [t2,t2+n] etc.. where n is some user defined horizon in minutes (i.e. 5 min).
I can't put the mean outside, because of different dimension of array it says. But, that would just return the mean of the whole array, and not for the time intervalls i guess?
Greetings
Kristoffer