LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

finding and averaging multiple rows

Solved!
Go to solution

What did you check the results against? Do you have another mechanism for calculating the averages or are you calculating them by hand?

 

One follow-up comment regarding the code. As I indicated, it's a first crack, and it's not the most efficient, but it at least doesn't crash because of memory issues. While it may not seem too slow, there's room for improvement. One thing that can (and probably should) be done is to do something akin to what the LabVIEW memory manager does when needing to allocate more memory for a growing array. In the while loop when you read 1000 lines then one can also allocate a 1000 x 2500 array and append it to the 2D numeric array prior to feeding it into the for-loop. Then in the for-loop one would use a Replace Array Subset rather than a Build Array. You would need to keep track of where to do the replacing.

0 Kudos
Message 11 of 16
(1,252 Views)
Solution
Accepted by Merida

OK. Found the problem. In my haste in writing the VI I made a dumb mathematics mistake in calculating the average which I spotted when I looked at the VI again. I'm always dividing by 2 which is incorrect since you can't get a new average by simply adding a number to the previous average and dividing by 2. One also needs to keep track of the running count of how many values were used to get the current average. To get the new average it's the ((old_average X previous_count) + new_value) / new_count, where new_count = previous_count + 1.

 

The attached should provide correct averages.

Message 12 of 16
(1,242 Views)

that is great smercurio, i can try to improve things now and make it more tuned to my application.

Best wishes,

M. 

0 Kudos
Message 13 of 16
(1,235 Views)
just a reply to your previous message, yes I was just checking by hand...:-)
0 Kudos
Message 14 of 16
(1,234 Views)

I'm Melvin Koshy a PG student. I'd like to know whether LABVIE can provide soft starting of Induction  Motor. Please specify the hardware associated with such an experiment.

 

Melvin

0 Kudos
Message 15 of 16
(1,119 Views)

Blondel wrote:

I'm Melvin Koshy a PG student. I'd like to know whether LABVIE can provide soft starting of Induction  Motor. Please specify the hardware associated with such an experiment.

 

Melvin


Please create a new post for your question - do not hijack a completely unrelated thread.

0 Kudos
Message 16 of 16
(1,105 Views)