Contour plots, or graphs, connect the dots in a two-dimensional plane with a line or the same color to give the graph the appearance of three dimensions. When you plot a contour map in MATLAB, you can use MATLAB's data cursor to display the value of any point in the graph, then extract it into a variable in MATLAB's workspace.
Instructions
- 1Load your contour plot in a figure window in MATLAB. As an example, MATLAB comes with pre-loaded images, including one of the head of a penny. You can load the penny image with this code:load penny;
figure;
contour(flipud(P));
axis square;The first line loads the penny image into memory. "Figure" opens a figure window. The third line creates the penny as a contoured surface plot. "Axis square" makes the horizontal-vertical aspect ratio look accurate for a penny. - 2Click the "Tools" menu in the figure window, then select "Data Cursor." Select values in the graph. Click anywhere and MATLAB will show a pop-up note over the point with its x and y position, as well as its value.
- 3Right-click on the point you want to select, and choose "Export Cursor Data to Workspace." MATLAB will pop up a small window for you to choose the name of the variable into which the data will go. Enter a variable name and click "OK." MATLAB extracts the data to the workspace as the variable.
- 1