How to Put Grid Lines Into a Matrix Matlab

How to Put Grid Lines Into a Matrix Matlab thumbnail
Grid lines make a Matlab matrix easier to read.

Matlab does not automatically add grid lines to information in a table, or matrix, format. You have the option to add grid lines manually, however, and doing so can both enhance its visual appeal and make a matrix -- especially a two-dimensional matrix -- easier to read. To add a grid, begin by defining a matrix as you normally would, then just before finishing, add a statement to format the matrix with grid lines.

Instructions

    • 1

      Start Matlab and open a new command window by clicking "File" on the main menu, "New" from the drop-down box that appears, then "Window."

    • 2

      Enter raw data into the new Matlab command window using commas or whitespace to separate individual elements and semicolons to identify rows. For example:

      Month = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
      Sales = [41.3, 77.4, 125, 165, 197, 248, 322, 345.5, 300.2, 288, 345, 400];

    • 3

      Plot the points of the matrix variables using an "x, y" axis. Indicate how you want to identify each plotted point, such as with an "o" in the plot command:

      plot(Month, Sales, ‘o’)

    • 4

      Add grid lines to your matrix. select "Edit" from the Matlab main menu, then "Edit" from the drop-down box that appears, then "Scale." Select "Grid" from the available options. As an alternate option, include the grid command via the command window using the command “grid on.”

Related Searches:

References

  • Photo Credit Hemera Technologies/AbleStock.com/Getty Images

Comments

Related Ads

Featured