How to draw a line of exactly 1cm in Matlab?

3 views (last 30 days)
I need to draw a line of exactly 1cm and 1.01 cm in the figure window? Any ideas?

Answers (2)

Walter Roberson
Walter Roberson on 5 Apr 2013

Jan
Jan on 5 Apr 2013
I would even claim: This is not possible. Exactly 1 and 1.01 cm (what could "and" mean here? A line can have one length only?) does not explain, where this dimension should appear: On the screen, on your specific screen, on your screen after the magnifier of the operating system has been applied, when printed on paper?
The scaling of objects on your screen depends on the value of get(0, 'PixelsPerInch'). But obviously you are forced to draw pixels. Then it is unlikely (but not impossible), that 1.00 and 1.01 cm match exactly the pixel dimensions. And if the scline factor of your monitor is 92.03542 pixels per inch, you can be sure, that you only get rounded value 92 in your settings of Matlab and the OS.
Therefore the need for "exact dimensions" for objects drawn by Matlab is extremely complicated and at least near to impossible depending on the wanted precision.
  1 Comment
Walter Roberson
Walter Roberson on 5 Apr 2013
PixelsPerInch is usually nominal, and does not take into account the user playing with the monitor controls.

Sign in to comment.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!