#010 - Increasing Matlab's cursor resolution

This function enhaces the decimal accuracy of the printed values in Matlab’s graphical user interface (GUI) for figures. This is helpful when dealing with very large point clouds, such as elevation models or backscatter scans. Sometimes manual selection at the pixel level is needed, which is challenging when dealing with hundreds of millions of datapoints.

Step 1

In this case the decimal float is expanded to 10 digits using the %.10f' TeX specifier. Matlab’s quite unhelpful default behaviour is to truncate the printed outText integer, this functions overrides that, plus adding floating point resolution.

function outText=DecimalGUI(obj,event)

  if length(pos)==3 % For scatter3 or plot3
    outText={sprintf('X: %.10f',pos(1)), ...
             sprintf('Y: %.10f',pos(2)), ...
             sprintf('Z: %.10f',pos(3))};
  else % For any other non-3D use
    outText={sprintf('X: %.10f',pos(1)), ...
             sprintf('Y: %.10f',pos(2))};

Step 2

To use this function, add the following string at the end of a new figure while the function code above is in a separate .m script within the same folder (as a standalone function in the working directory), or at the very end of the same .m script. The figures below show how the cursor looks like before and after this fix.