‎11-04-2012 10:04 PM
I have a four channel virtual oscilloscope. I trigger and get values in a 2D array. I want to average five consequetive results. However, the program I am trying to modify is coded badly, I cannot use shift registers. My only option is storing the oscilloscope values somewhere and after getting five of them dividing by five.
I tried with arrays but I don't havw much experience, so I could not get it done. What would be the best approach?
Thanks,
Erden
Solved! Go to Solution.
‎11-05-2012 02:08 AM
Hi Erden,
1) Why can't you use shift registers? They would be the first approach to store data...
2) When you don't have experience you should always start with the (free) LabVIEW courses offered be NI!
3) When you still have no experience you should continue be studying the examples coming with LabVIEW!
4) After solving points 1 to 3 you should store your data in an array and calc your average by summing an dividing...
‎11-05-2012 08:52 AM
Hi GerdW,
Thanks a lot for your post.
1) It is a very badly structured code, it seems impossible to use shift registers. When I have time, I will try implement a state machine structure.
2) I recently took Core 1. I developed some other applications, implemanted state machines. So far everything was ok.
3) I also studied the examples. However it seems like I am missing something very basic.
4) Here is the problem:
I have experience with text based programming languages. Here is my logic:
Initialize SUM
for i =1 to 5
SUM=SUM+Acquired value
Next
RESULT = SUM / 5
When I run "SUM=SUM+Acquired value", I get zero. I define SUM as a local variable in order to process.
Isn't that the right approach?
Thanks a lot,
Erden
‎11-05-2012 08:56 AM - edited ‎11-05-2012 08:56 AM
‎11-05-2012 09:17 AM
Hi GerdW,
Yes you are right. I should quit my old habits form text based languages
Instead of trying to modify the bad old code, I will code it from stracth and implement one of the solutions you suggested. That would be a nice practice for me.
Thank you very much and have a great day!
Erden