LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep the data on XY Graph

Solved!
Go to solution

Hello Guys,

 

I am a newbie on labview and I need your help please. 

I want to keep the data on XY graph in my state machine named "sinus" . Do you have some ideas for me . I think that my shift register will save the data but nothing .

 

Thank you guys in advance

 

Ngoc-Vinh Truong

Download All
0 Kudos
Message 1 of 15
(7,321 Views)

You might want to check out this nugget: Sporadic Waveform Chart


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 15
(7,315 Views)
Solution
Accepted by topic author vinh.t

Your shift registers in "sinus" do accumulate data while you're executing that state, but you reinitialize them each time you restart the "sinus" state, so anything stored in them gets cleared out. If you don't want to reinitialize them each time, you need to feed the output of the shift registers on the right side of the loop back to the input side, or use a Feedback Node instead of a shift register, and move its initialization terminal out one loop.

0 Kudos
Message 3 of 15
(7,303 Views)

Thank you for your answer my friends ! 

 

I understand why we use the feedback node but I don't know what do you mean for the initialisation. 

Where should I put the initialisation ?

0 Kudos
Message 4 of 15
(7,273 Views)

For a shift register in a loop, each time the loop restarts at iteration zero (e.g. each time you reenter the "sinus" state), the shift register is reinitialized to whatever's wired to the terminal on the left edge of the loop, in your case an empty array. If you only want the initialization to happen when the program first starts and not again each time you reenter the "sinus" state, then you can right-click the shift register and change it to a feedback node, then right-click the feedback node and select "move initializer out one loop". That way the initializer will be moved out to the edge of your main loop, and the feedback node will only be initialized once, when the program first starts.

0 Kudos
Message 5 of 15
(7,264 Views)

Thank to you my friend that I succeeded ! 🙂 

All your advice was very clear ! Have a good day , you make me happy ! 🙂

0 Kudos
Message 6 of 15
(7,260 Views)

Sorry to bother you again. 

Do you know how can I clear the history of the graph?

 

I try to put the invoke method  "reinitialize to defaut" outside the loop with the method of producer and consumer . But I call for this method, it  appears that, it clears the graph but when I recall for the case of sinus, It plots the graph with the old graphs .

Download All
0 Kudos
Message 7 of 15
(7,250 Views)
Solution
Accepted by topic author vinh.t

The data isn't being stored in the graph, it's being stored in the feedback node, same as it was with the shift register. Whatever you pass into the node gets output again on the next iteration. If you want to clear the data in the feedback node you have to feed it an empty array, and then that's what'll come out of it on the next iteration. For example, your "Clear Graph" button could control a Select node, with the wire for your accumulated data wired to the "false" terminal, an empty array wired to the "true" terminal, and the output of the Selector wired into your feedback node. That way when you set "Clear Graph" to true, it'll feed an empty array into the feedback node instead of your data.

 

Note that the index integer that you're using to build your X-array is still going through a shift register; I'd suggest handling it the same way as the Y-array data so they don't get separated. The way it's set up now the Y-array data will be initialized each time the program runs, but the X-array will remain in the shift register if you stop and restart the program running.

 

0 Kudos
Message 8 of 15
(7,241 Views)

What do you mean because I think that I do like you say but the program does not work now ? 

It goes to init-waiting of but-and again

Download All
0 Kudos
Message 9 of 15
(7,235 Views)

I think you don't understand the concept of dataflow properly. With the "Clear Graph" button outside of the main loop like that, it only gets evaluated once at the very start of your program execution and never again, and even then it's just selecting between two identical empty arrays to initialize the upper feedback node with. If you want the "Clear Graph" button to have an effect, it'll need to be located somewhere inside the program where it will be checked during execution. Currently your feedback nodes are contained within the "sinus" case, so you'll only be able to clear the graph while the "sinus" case is executing, since that's the only time you can write your empty array into the feedback node.

0 Kudos
Message 10 of 15
(7,229 Views)