取消
显示结果 
搜索替代 
您的意思是: 

Coercing a cursor to specific values

已解决!
转到解答

Hi everybody.

 

  I wrote a code that records the values of the cursor on an XY graph. I do not want the measured values to exceed certain ranges, which is easily done by coercing them, but I also want to make sure the cursor itself does not "leave" the desired range. I tried to do this by simply testing if the value from the cursor was out of the desired range and if so, assigning the coerced value to it. However, every time any value is assigned to the cursor in the property nodes, it simply goes to (0,0). Even if only the x or only the y are assigned, the cursor goes to (0,0). I set the cursor to single-plot and prevent the plot from scrolling.  

  I attach the diagram. Can anybody help?

0 项奖励
1 条消息(共 6 条)
4,472 次查看

There is no need to constantly set the scale range. Disable autoscale and disable "advanced:cursors scroll graph". Since the limits correspond to the scale, no programming is needed. If needed you could use an event structure with a "cursor move" event to reset the positions of you get out of a desired range.

 

(Typically it help if you would attach your VI. It is difficult to debug a code image. Closing a direct reference is also not needed. How exactly does the graph receive data? The terminal seems disconnected. Your wait connects to a constant with the wrong datatype)

0 项奖励
2 条消息(共 6 条)
4,457 次查看

Thanks. I tried what you suggested but it still does not change the behavior. I attach the vi.

0 项奖励
3 条消息(共 6 条)
4,448 次查看

I even wrote a much simpler VI, that does nothing except input 5 to the X and Y of the cursor of an XY graph just once, and it still sends the cursor to (0,0) regardless of the values inputted to it.

0 项奖励
4 条消息(共 6 条)
4,445 次查看
解答
接受人 ronenGabizon

Your cursor is locked to a plot, but the plot has no data. You need to have a free cursor to place it at random locations.

5 条消息(共 6 条)
4,429 次查看

Thanks, setting the cursor as free did the trick.

0 项奖励
6 条消息(共 6 条)
4,396 次查看