Pages

Wednesday 9 March 2011

GUI for Linking figures in MATLAB

It's been a while that I haven't written anything for my blog. Here I come, with a new post. This post is related to linking figure in MATLAB. I worked with MATLAB with mainly for image processing and often, I was annoyed with MATLAB that it does not have function to link figures which would facilitate the comparison between two figures. In ENVI, there a way to link open figures with help of coordinate information based georeferencing. But in MATLAB, all we have is rows and columns information. So the problem was, when I want to compare Lidar First Pulse data with Lidar Second Pulse data there is no way to link those two figures which have same number of rows and same number of columns.

Therefore, I have decided to build a GUI which would allow me to open linked figures, if they have same numbers of rows and columns. The main functionality, I wanted to have is that if I zoom into a certain area in Figure 1, the same is area is also zoomed into the Figure 2. Same applies when I am panning in either of the figures. If I pan in Figure 2, the Figure 1 also should be panned automatically displaying exact spatial extent as being displayed in Figure 2.

So, here is the GUI that I have come up with. The GUI has a button which can be useful to update list in the GUI with variables that are in the base workspace. This is handy in the situation for example, I opened the GUI and perform some operation in the command window and now I want to update my variable list in GUI and populate it with variables that are in the base workspace. Once the variables are there, just click one of the variables and click Plot first figure. Afterwards click other variable which is of same size with variable first selected, and click Plot second figure. Now the figures are linked with each other. You can zoom around and pan around in one figure and instantly other figure will be updated to match the new extent.

2 comments:

  1. Nice!!

    How did you do the linking



    - Abhishek Kumar Gupta

    ReplyDelete
  2. Hi abhishek,

    check the function linkaxes ! you will find your answer !

    ReplyDelete