Increasing the number of significant figures from a cursor tag

Hello, 

I have a macro that was written by a previous lab mate that inserts a tag with the x value when you have the cursor placed on the graph. This is a very useful macro, however, on a current data set I am analyzing, I realized it only gives sigfigs to the hundreths place, but I need to look at differences in peak position that are <0.01. So I am trying to modify this macro to include more sigfigs. I do not understand however how hcsr() function abstracts the x values and the documentation does not include anything on this topic. 

Any ideas would be very much appreciated. 

Thanks

Macro TagItX()
    variable cmPosition = hcsr(A)
    variable xPosition = xcsr(A)
    String LocValue = "\\Z14" + num2str(cmPosition)
    Tag /O=90 /F=0 /A=MB /X=0 /Y=10/L=1 /B=1 $CsrWave(A), xPosition, LocValue
EndMacro

instead of num2str, try using sprintf to insert output of hcsr() into the LocValue string in whatever format/precision you like

DisplayHelpTopic "sprintf"

 

Have a look at: DisplayHelpTopic "num2str"

You probably want something like:

Macro TagItX()
    variable cmPosition = hcsr(A)
    variable xPosition = xcsr(A)
    String LocValue
    sprintf LocValue "\\Z14 %.9f", cmPosition
    Tag /O=90 /F=0 /A=MB /X=0 /Y=10/L=1 /B=1 $CsrWave(A), xPosition, LocValue
EndMacro

opps, too late!

I may have been a few seconds quicker to post but, as usual, it was Christian that provided helpful working code.

well, no problem to be second after Tony.

After all it was him who introduced me to Igor, must have been in 2000 or so and IP3 ;-)