File Exchange Pick of the Week

Our best user submissions


Idin's pick for this week is custom GINPUT by our very own Jiro Doke.

This is the story of how a user's request for a feature turned into a File Exchange submission by one of our very capable Application Engineers.

A few months ago I was working with a user trying to build a MATLAB GUI when we ran into a seemingly trivial problem: we needed the user to select a few points on a figure. Solution was simple: ginput. The problem was that on some images MATLAB's default "cross-hair" cursor blended into the background. Here's an example that shows a mild case of the problem.

You can see how it could be difficult to pick a precise point using this cross-hair. MATLAB's ginput function provides no flexibility to change the cursor. We found the myginput submission by Frederic Moisy. This got us a little closer, but not quite there. That's when I asked Jiro for help. Jiro wrote a new function based on MATLAB's ginput that makes the color and thickness of the cursor fully customizable. Here’s the same image, but this time with Jiro's ginputc function:

load woman
ginputc('color', 'r', 'linewidth', 3)

The picture speaks for itself! Jiro went further and added two new features that I hadn't even asked for:

  • In the top left corner he shows a list of points the user has already selected
  • He can optionally connect the selected points (very useful if you're selecting an area)

I would like to see some of these features find their way into MATLAB's ginput function. But in the meantime, I encourage you to download and try Jiro's ginputc function.

As always, your comments here are greatly appreciated.

Published with MATLAB® R2012b

  • print


댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.