From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically clear cursors

Solved!
Go to solution

Hello!
 
I am trying to find the proper way by which cursors should be programmatically removed in LV 2012. There is an old thread about it: http://forums.ni.com/t5/LabVIEW/resetting-cursor-lists-programmatically/m-p/1490310/highlight/true#M... I initially posted this message in it, but I am not sure whether anyone saw it...

Probably the bugs mentioned in that old therad should be fixed now but it seems to me that the problem reported at the beginning of the thread is still alive.
  

I programmatically create a list of cursors to highlight spikes on a waveform graph (See cursors_created.jpg).
 
Then I cleane them all, except for the Threshold cursor. I remove all entries from the cursor list except the first one and rewrite the property.  (see CleanUp_cursors_Vi.png).
  
The result I get is visible in Cursors_cleaned.png. What I wish to have is only the Threshold cursor visible in the Cursors area, without the coordinates of the deleted ones. 

Can anyone advise about how to fix this issue? The workaround proposed by Paul Davidson doesn't work for me.
 
 
Thanks a lot!
MG

 

0 Kudos
Message 1 of 16
(4,048 Views)

hi,

 

split 1d array seems to work fine ...

 

 

2015-08-31_set.PNG

2015-08-31_re-set.PNG

 

 

 

 

0 Kudos
Message 2 of 16
(3,998 Views)

Would it be more efficient to create a duplicate graph (display style - red points), then leave only points below threshold, and replace other - with NAN (not to show them on graph)? I would say it will be easier for labVIEW to display the second graph, rather than 20 cursors.

0 Kudos
Message 3 of 16
(3,968 Views)

@alexderjuengere wrote:

split 1d array seems to work fine ... 


"Reshape array" seems to be more logical. Why use split if you are only interested in one of the outputs?

(quote from the help on reshape: You also can use it to increase and decrease the size of a 1D array.)

 

Second choice would be "array subset".

 

(... and I also agree with the other comment that using cursors for all this seems overkill)

0 Kudos
Message 4 of 16
(3,963 Views)

@altenbach wrote:

"Reshape array" seems to be more logical. Why use split if you are only interested in one of the outputs?




good point, I wanted to re-create the behavior reported by @MG70:

 

[...]] Then I cleane them all, except for the Threshold cursor. I remove all entries from the cursor list except the first one and rewrite the property.  (see CleanUp_cursors_VI.png ‏12 KB )

 

0 Kudos
Message 5 of 16
(3,951 Views)

Hi Alexander,

 

thank you for your helpful reply! You are righ. The sample vi you created doesn't show the issue and this made me wonder where else my problem came from.

 

Then I slightly modified your vi to represent a situation closer to what I have in my code. I added an event case and a tab control.

The waveform graph and the  creation of the cursors is one event and the rest in another. Please try this:

 

- create the cursor list in the "Set Cursors" tab by clicking on the "Set Cursors" button

- reset them in the "Reset Cursors" tab by clicking on the corresponding button

- click again on the "Set Cursors" tab to see what the graph looks like

 

you will see that cursors are no more shown on the graph, their names are cleaned by the list, but their coordinates are still there.

You can also click on them and delete them, but after a while you likely get a runtime error and LabView crashes. This makes me think that the cursors are actually deleted, but still the coordinates are visible for some reasons.

It seems that having the diagram in one event and cleaning the cursors in another is the core of the problem.

 

Maybe I am doing something wrong in the code?  Please, don't bother about the fact that in the "Reset Cursors" I use a Reference for the Wavefrom graph and I wrire it to the Curosrs List property. I could have used the Wavefrom graph property directly and the result would have been the same.  

 

Please, let me know what you think.

 

Thanks a lot!

MG

 

Set_Cursors.png

Cursors_cleaned.png

0 Kudos
Message 6 of 16
(3,918 Views)

Thank you Altenbach for your suggestions.

 

I agree, I could also use the Array Subset instead of the Array Split. The result is the same and it is probably more logical. 

Best regards.

MG 

0 Kudos
Message 7 of 16
(3,915 Views)

@MG70 wrote:
[...]

 

you will see that cursors are no more shown on the graph, their names are cleaned by the list, but their coordinates are still there.

You can also click on them and delete them, but after a while you likely get a runtime error and LabView crashes. This makes me think that the cursors are actually deleted, but still the coordinates are visible for some reasons.

It seems that having the diagram in one event and cleaning the cursors in another is the core of the problem.

 

Maybe I am doing something wrong in the code?  Please, don't bother about the fact that in the "Reset Cursors" I use a Reference for the Wavefrom graph and I wrire it to the Curosrs List property. I could have used the Wavefrom graph property directly and the result would have been the same.  

 

Please, let me know what you think.

 

Thanks a lot!

MG

 

 

 


 

hi,

using MG70_cursor.zip ‏20 KB :

if you  put the Waveform Graph outside the Tab Control on the Frontpanel, the Cursors' coordinates will also vanish:

2015-09-01_0.PNG

2015-09-01_1.PNG

 

 

 

 

0 Kudos
Message 8 of 16
(3,900 Views)

Hi!

 

True, but the problem is that I can't put the waveform on the frontpanel for the way in which the all interface is built....

However, the cleanup of the cursors should work reagrdless the waveform is on the frontapnel or not. Right?

 

 

Thanks!

MG

 

 

 

0 Kudos
Message 9 of 16
(3,886 Views)

@MG70 wrote:

 

However, the cleanup of the cursors should work reagrdless the waveform is on the frontapnel or not. Right?

 


 

Obviously, it does matter which page of the tab control is active, e.g. putting the Graph on the same page as the reset Button would work with

2015-09-01_2.PNG

2015-09-01_3.PNG

 

 

 

 

 

 

0 Kudos
Message 10 of 16
(3,844 Views)