Skip to main content

2.13) Commands


Using Matlab is not all about typing into the command window and reading outputs off the screen. This page shows some better ways to interact with the command line. The next page shows how to use scripts more efficiently.

  • The commands that you type in the command window are recorded by Matlab within the command history window.
  • To repeat a command you can double-click the appropriate entry within the command history window.
  • Alternatively within the command window you can use the <up arrow> and <down arrow> at the command prompt (>>) to cycle through past commands.
  • This way of repeating commands is useful when you are refining your commands.
  • When Matlab outputs an answer to the command window, it precedes the answer with "ans=". That is, Matlab assigns the answer to a variable named "ans".
  • We will learn more about variables in the next section.
  • One of the most insightful commands is "why". Enter it at the command prompt and press enter.