LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mean of mesure OR don't show 0 !

that's true ! didn't think about upload my VI ><

sorry

 

0 Kudos
Message 11 of 22
(1,096 Views)

I am with Bob Here. It is much easier both for you and for us of you simply attach your VI. You don't need to capture, crop&save multiple screenshots and we have something that we can run. Win-Win!

 

Also never attach screenshots. The forum has a tool to insert pictures into the post if needed so we don't need to click things.

 

You apparently did not understand my point of duplicate code. All you need is parse the string outside the case structure, then branch to the desired indicators according to the case

 

What's the significance of the values 2^31-1? (What that once a NaN before you changed it to I32??? 😮 Come on!)

 


@siwalex wrote:

Like what? what's an unbroken code?


Unbroken code (as the name implies!) does not have a broken run arrow.

 

I doubt the current code works: All you'll ever execute is the default case because the string will never be "43.1" or 45.1". The string is always longer than that, triggering the default.

0 Kudos
Message 12 of 22
(1,094 Views)

Replace your convoluted case structure with the following:

 

snip3.png

 

mcduff

0 Kudos
Message 13 of 22
(1,089 Views)

ok, 

i think the code is beter like this

just need help to do the graph now  with the "NaN"

0 Kudos
Message 14 of 22
(1,087 Views)

Yopu cannot have NaN for integers, so you need DBL.

 

Here's what I would do (all ideas from my first post, now some repeated by others). Fully scalable for as many channels as you want after a few more simple changes.

 

tempchart.png

 

Also remember to chose a plot style with actual points, not just lines. with only lines you will no see point surrounded by NaN on each side! Another option would be to graph stale values in the case of missing values. Maybe even better.

 

(Also note that you code still has potential race conditions because you cannot guarantee that the chart history gets reset before the loop starts. Right?)

 

0 Kudos
Message 15 of 22
(1,081 Views)

And her's the same with random temperatures.

 

tempchart.png

Message 16 of 22
(1,076 Views)

true.

Thank's for the help.

tomorow i will continue my code and i will post it when it's done 🙂

(with means etc)

and i will post the full project with database comunication.

maybe you will tell me if i can optimise my code.

have a good end of weekend

0 Kudos
Message 17 of 22
(1,073 Views)

As I already hinted, I would recommend to retain the stale (=last seen on that detector) values instead of using NaN. Now the 5 point average looks nice and there are no gaps.

 

tempchart.png

0 Kudos
Message 18 of 22
(1,068 Views)

The problem of mean is, i have a Hub to recieve informations from nodes (43 and 45). I will have 4 nodes in total (maybe more later)

the hub can recieve only 1 information for exemple node 43 in one time. if he recieve node 43 on time then 10 times in a raw node 45, the mean will be wrong. 

is it possible the mean not take in consideration the NaN? or just take the last value who was not a NaN for the calculs?

mean.PNG

 

0 Kudos
Message 19 of 22
(1,052 Views)

@siwalex wrote:

 

the hub can recieve only 1 information for exemple node 43 in one time. if he recieve node 43 on time then 10 times in a raw node 45, the mean will be wrong. 

is it possible the mean not take in consideration the NaN? or just take the last value who was not a NaN for the calculs?


My latest code does not use any NaN except at the beginning before any values have been received. After that, each channel shows the mean of the last five iterations. If there are more than five iterations with no new data, the displayed value will be constant of course. I don't consider that wrong by any definition and I am not sure why you are bringing up that ugly word.

 

LabVIEW is a full featured programming language and you can implement any exception handling you want, but first you need to know what you actually want. For us to help we need to know what you consider "right", not what you think is "wrong".

Message 20 of 22
(1,043 Views)