LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clearing waveforms

Hi I am trying to clear my waveform by using a clear button, which i created using a state machine. I tried to create a property node of history data but it does not exist so I could wire an empty constant to it, but the property node history data does not exist. Any idea, here are screen shots of my cases
Download All
0 Kudos
Message 1 of 11
(3,942 Views)
What chart are you tryng to clear?  I use the history node to clear the chart also and always seems to work.
Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 2 of 11
(3,928 Views)
I am trying to clear the measurement waveform located in the run-case.jpg file. I right click it and try to creak a propoert node to clear the history but it does not exist.


Cheers
Alloush
0 Kudos
Message 3 of 11
(3,925 Views)
Depends on what you mean by "clearing" your waveform.  I assume you want to reset the indicator.  Which approach you should use depends on wether you are using a waveform graph or a waveform chart

If you just want to blank a waveform graph, you can drag the "Measurement" indicator outside the case structure, reconect the wire, right click on the tunnel, and select "Use Default If Unwired".  The default for a waveform datatype is an empty Y array, 0 dt and t.  IMHO, this is the quickest and easiest approach. 

However, this does not work on waveform charts.  A graph will only display the current data, whereas the chart will display ALL the data it has ever recieved (since being reset).  To clear a waveform chart, right click Create>Property Node>History Data, change it to "write", right click on the input terminal, and select Create>Constant.  The constant should automatically be the default described above..

I am not sure from your description what the difference between "clear" and "initialize" are...::
0 Kudos
Message 4 of 11
(3,919 Views)
Dear Jason,

Thank you for your help, I am attaching my VI if you can take a look at it. When I hit clear I want to be able to clear the waveform and the data. I tried your suggestion but it does not seem to work. I would also like to add a saving action do u think i should do that as a seperate state ?


Thank you
Alloush
0 Kudos
Message 5 of 11
(3,916 Views)
Ahhhh, I see the problem.  Measurement is in the inner while loop and you want to see that updating until you hit "stop".  So the "Use Default" trick will not work as easily. You can simulate the waveform chart property "History Data" on a waveform graph by using the "Value" property.  Again, rightclick on the input terminal and select Create>Constant to get the empty waveform. 

A few notes on coding style.  Take care to not hide block diagram elements behind one another.  It took me more than a few moments to figure out how the outer while loop was supposed to stop.  Also, a Wait function (even as small as 1 ms) will prevent this vi from completely hogging the processor while it waits in the Initialize state. 
0 Kudos
Message 6 of 11
(3,907 Views)
Hi Jason, Thank you for your help. I am a complete newbie to labview this is my third day using it. I tried using the value property and wiring a constant and still does not work it gives me run errors. Would you mind if you can do it for me so I could learn, in addition to the timing delay you mentioned (so as not to hog up the processor), as It would be a great oppurtunity for me to learn.

About the hidden block diagrams, I did not spot any?

Best
Alloush
0 Kudos
Message 7 of 11
(3,905 Views)
I am sorry Alloush.  I am a firm believer in learning by doing.  Robot wink You are doing really well for your third day, I must say.   I will walk you through what I did.

First go to the block diagram.  Right click on the Measurement indicator and select Create>Property Node>Value. 


Drag the created node off to the side and switch over to the Clear case.  Drag the property node into the cleare case.  Right click on it and select Change to Write.  This will allow us to write whatever you want to the graph.  Since we want nothing (i.e. default data), we can right click on the input terminal and select Create>Constant.


The wait is pretty simple.  You can find it on the Timing palette.  Without the Wait, the vi will attempt to process the Initialize case over and over as fast as it can.  1ms is enough of a break to free up the processor for other tasks, while short enough to prevent the bizzare case of someone pressing two buttons at the same time.


Finally, if you grab the case structure and drag it down a couple inches, you will see that the stop condition for the while loop is hiding back there. Robot surprised 


Message Edited by jasonhill on 08-15-2006 09:41 AM

Message Edited by jasonhill on 08-15-2006 09:42 AM

Message Edited by jasonhill on 08-15-2006 09:44 AM

Message Edited by jasonhill on 08-15-2006 09:44 AM

Download All
Message 8 of 11
(3,903 Views)
Jason Thank you so much buddy, you have been great. I did what you told me to do, although i do not receive errors, when i hit the clear button when running the VI the waveforms still appear on the graph but are set to their initial condition i.e they are just phase shifted somewhat. The timing thing is simple, shall i always use a timing delay ? If I want to add a saving option shall i put it in its own state, or can I add it in the run state ? (good code practise)


Thank you man, its been a pleasure

Alloush


0 Kudos
Message 9 of 11
(3,892 Views)
Curious.  I am not sure why clear is not working as expected. 

As for saving?  I like using Write Waveforms to File.  Where to put it? If you want to save it every time it is run, just stick it in after the aquisition loop closes. 

If you only want to save sometimes, you need to be a little more sneaky.  You will need a shift register.  It would be worthwhile to pull up the help file on this one, its pretty good.  It is a little involved to describe all the steps (even with illustrations) So I broke down and included an example.  Robot wink  I put a save in each location described.  Delete the one you do not plan on using.  I did not add a save button (yet).  That will need to be lumped into the array in the initialize case.

Note that each case passes the waveform wire through.  This is because each case must have some value for the waveform array, but only the run and clear cases actually change anything.  I also changed up the method for clearing the array.  I explicitly destroy the Y-values for each waveform.  I do not have any DAQmx hardware on this machine, so I cannot test it.  But it should properly clear the array, now.

In hindsight, I could have just deleted all that junk in the clear case for clearing the waveforms and set the output terminal to "Use Default if Unwired" like I described in the first post.  Robot tongue  Try this if it is still not clearing properly.

Message Edited by jasonhill on 08-15-2006 10:32 AM

0 Kudos
Message 10 of 11
(3,888 Views)