Units and unit prefixes for setvars

Igor nicely handles unit prefixes for graph axis labels when the scaling has been specified for the wave.

Ex.

•make/o/n = 1 Current
•SetScale d 0,0,"A", Current
•Current = 0.001
•display Current

Note the Y-axis label automatically has the unit "A" and the prefix "m".

SetVars can be tied to a single element of a wave but AFAIK the unit and the unit prefix can't automatically be displayed along with the value.

It would be helpful if Igor displayed the units and unit prefixes of setVars tied to wave elements automatically. Failing that, is there code that could be added to the setvar procedure that could update the setVar title to display the unit and unit prefix? In particular, is it possible to take advantage of whatever Igor is using to determine the unit prefix for graph axis labels?

Thank you for your help.
You can use the format keyword with a %W token in the format string. However, note the following warning for the format keyword of SetVariable:

Never use leading text or the "%W" format for numbers, because Igor reads the value back without interpreting the extra text.


But if the SetVariable is read only (non-editable), I think it might be ok to use %W in the format string.

Alternately, you could use a ValDisplay control with %W in the format string.

See the help for printf for information on what the %W token does.