Prev: more than 10 seconds on the scope??
Next: Remove only concecutive repetitions in an array/matrix
From: Kevin on 5 Mar 2010 13:45 It is kind of a silly question. But I cannot find a ruler in the office and I want to know how long is one inch. Since I have matlab and image processing toolbx, I think about just drawing a horizontal line in a figure window. But how would one draw a horizontal line (one inch long) in a figure window. I would like this to work regardless of the resolution or physical size of the computer screen. Thanks.
From: matt dash on 5 Mar 2010 14:41 "Kevin " <kevin(a)northpole.com> wrote in message <hmrjgc$l34$1(a)fred.mathworks.com>... > It is kind of a silly question. But I cannot find a ruler in the office and I want to know how long is one inch. > > Since I have matlab and image processing toolbx, I think about just drawing a horizontal line in a figure window. But how would one draw a horizontal line (one inch long) in a figure window. > > I would like this to work regardless of the resolution or physical size of the computer screen. > > Thanks. Theoretically you could check get(0,'screenpixelsperinch') and draw a line that many pixels long by making an axes with axes('units','pixels','position',[0 0 x 100],'xlim',[0 x]) where x is some number>100ish. But there's a good chance your screenpixelsperinch isn't really that accurate. on my monitor it's off by about 1/16 inch.
From: Walter Roberson on 5 Mar 2010 15:00 Kevin wrote: > It is kind of a silly question. But I cannot find a ruler in the office > and I want to know how long is one inch. It's about the width of your thumb. > Since I have matlab and image processing toolbx, I think about just > drawing a horizontal line in a figure window. But how would one draw a > horizontal line (one inch long) in a figure window. > I would like this to work regardless of the resolution or physical size > of the computer screen. Can't be done automatically. Matlab does supports inches as measurement units, but Matlab's notion of what an inch is, is dependent upon what the operating system tells Matlab about the pixel density, which in turn is dependent upon what the monitor tells the operating system about the pixel density. Unfortunately, monitors often lie about pixel densities, either deliberately or because monitors are not smart enough to take into account user horizontal and vertical sweep adjustments of the monitor. Also, modern LCD monitors are often built with their pixels spaced a precise _metric_ distance apart such that there often is not a whole number of pixels in one inch. and since you cannot light up a fraction of a pixel, your line would be too long or too short. > It is kind of a silly question. But I cannot find a ruler in the office > and I want to know how long is one inch. I think you have been "creative with the truth" with. No-one needs the general solution to this problem just because they don't happen to have a ruler handy. On the other hand, people need general solutions to this problem because it has been given to them as an assignment as an introduction to Matlab graphics. Sigh. Whatever. The reason for you wanting the general solution for this does not change the fact that the general solution does not exist.
From: Kevin on 5 Mar 2010 19:03 Walter Roberson <roberson(a)hushmail.com> wrote in message <hmrode$cqn$1(a)canopus.cc.umanitoba.ca>... > Kevin wrote: > > It is kind of a silly question. But I cannot find a ruler in the office > > and I want to know how long is one inch. > > It's about the width of your thumb. > That is also what I use (especially when I don't have Matlab. yeh i know. I use matlab too much). I even told my wife (who is also an engineer) that my life would not be the same without Matlab, she got a bit upset. But one interesting note is that the size of our thumb is roughly universally one inch in width (or length). I am chinese and I am pretty slim. I would think that the thumb of a Western person would be bigger. Thanks for the detailed description on how our computer screen does display. I will read that tonight. I guess it is safe to conclude that it is not a trivial thing to draw an one-inch horizontal line in Matlab. Thanks for everyone's suggestion.
From: Walter Roberson on 5 Mar 2010 19:18 Kevin wrote: > Thanks for the detailed description on how our computer screen does > display. I will read that tonight. I guess it is safe to conclude that > it is not a trivial thing to draw an one-inch horizontal line in Matlab. Computers can only make decisions based upon the inputs they are given, and displays are one of the cases where the inputs are inaccurate more often than not. For example, some of the people I have worked with have had significant vision problems, and so use a magnifying glass in front of their scr, or a display that has been adapted to have a magnifying glass built into it, or a display that has a built in electronic magnifying glass that enlarges the portion of the screen the person wants to look at. In all of these cases, creating a line on the display that will be one inch long when it reaches the person reading it, would require a lot of work... especially if the spherical axes of the magnification glass were not properly aligned, so that the magnification was unequal in X and Y and would depend upon exactly where the person was looking from and toward. Plotting a *nominally* one inch line is trivial: plot([0 1], [.5 .5], 'Units', 'inch') Unfortunately in the real world, it will probably not be 1 inch as measured by a ruler, and thus is unsuited as a replacement for a ruler.
|
Next
|
Last
Pages: 1 2 Prev: more than 10 seconds on the scope?? Next: Remove only concecutive repetitions in an array/matrix |