LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clear values in indicator after each run

The values in the indicator  stay after each run and therefore add up in the next run and provide incorrect values. This is for finding average of one parameter. I tried using the invoke node for reinitializing to default value as well with no luck.

I looked into other posts.. and removed my for loop which had a shift register(which happened to be the problem for a lot of ppl).
I am using a feedback node though.How can I get rid of the old numbers? using LV8.2
0 Kudos
Message 1 of 9
(5,704 Views)

Sorry, I have no idea about which indocator you're talking about, but try the following:

Go to "VI properties...execution" and select "clear indicators when called".

(Overall, you have way too many unnecessary sequences and local variables.)

Message 2 of 9
(5,697 Views)
I am talking about the avergae Q which goes into the XY chart in the right most part of the block diagram right after sequenc in the while loop. The XY chart has to plot Q as well as average Q after every iteration. the average holds on to the previous value and plots from there (sorry about the poor coding!)

I tried changing the VI properties just now .. but it still does the same
0 Kudos
Message 3 of 9
(5,686 Views)
Charts retain a history of the data which has been written to them. If you wish to clear that data programmatically, create a property node for the history and write an empty array to it.

As altenbach said, you can get rid of the sequences and local variables for a much more readable and maintainable program. Data flow and error clusters can be your friend. Consider a state machine.

Lynn
0 Kudos
Message 4 of 9
(5,684 Views)
I faced the problem with the chart earlier and went ahead and created a property node for the history and attached an empty array to it. Only yesterday I was asked to add another plot to the XY chart and therefore added the average . The chart clears before the run; even the average is shown to be zero before the run.. but once it starts running, it starts averaging using the previous value as well.

as per the poor coding, will get to it soon. thanks a lot
0 Kudos
Message 5 of 9
(5,681 Views)


@UofH wrote:
 but once it starts running, it starts averaging using the previous value as well.

None of the code you show does any "averaging", thus the problem must be withing the qmeasure.dll. Do you know who made it? Is it LabVIEW based?

Attached is a quick try at code cleanup. (LabVIEW 8.2.1) with a few comments. Basically, you seem to use hidden controls for the sole purpose of using local variables. None of these are needed. Let me know if you have any questions.

The way you programmed it leads to "tunnel vision coding": it is impossible to see the big picture because you can only see 5% of the code at any given time.

You should always use the error cluster to determine execution order. You probably als want to stop the loop if an error occurs (not implemented).

0 Kudos
Message 6 of 9
(5,669 Views)
Oh my GOD! That was an awesome clean up! It looks so much better now.. guess thats the difference between amateur and not!

I also apologise for posting the wrong code.. I mean its the same program but I did not save the changes I  made before attaching the file and so you couldnt see what I was talking about.. Really sorry about that. I added the average part to the XY chart (I have a feeling I am doing the avg all wrong btw 😞
having said that, the values of the average remain after each run and so add up in the next one.
0 Kudos
Message 7 of 9
(5,656 Views)

OK, two simple things:

You should initialize your feedback node. Right-click on the initializer terminal on the left and "create constant" ( switched to a shift register for better code clarity, but it's the same thing)

Also the input to clear the chart history needs to be a cluster since you changed the datatype.

The attached should point you in the right direction. I made a few other minor changes, e.g. the "sum" indicator should probably come after the adition of the new element, not before.

Message 8 of 9
(5,645 Views)
BINGO!! U R THE *STAR * thanks a lot for taking time to make changes in my ugly code!
0 Kudos
Message 9 of 9
(5,642 Views)