Skip to content

MATLAB - Environment Setup

MathWorks provides several ways to access MATLAB, catering to different needs from professional engineers to students.

This is the traditional and most powerful way to use MATLAB. You can download the installer directly from the MathWorks Downloads page. You will need a MathWorks account. Most universities and companies provide licenses. A free 30-day trial is also available for evaluation. The installation is guided by a graphical installer and is straightforward.

For a modern, cloud-based experience, you can use MATLAB Online. It runs in your web browser with no installation required. It provides access to the latest version of MATLAB and popular toolboxes, along with integrated cloud storage (MATLAB Drive). This is an excellent option for quick access, teaching, and collaboration.

The MATLAB desktop is a powerful Integrated Development Environment (IDE). Its default layout consists of several key panels:

+--------------------------------------------------------------------+
| Toolstrip (Ribbon with HOME, PLOTS, APPS, EDITOR tabs) |
+--------------------------+-------------------------------------------+
| | |
| Current Folder | Editor / Live Editor |
| (File navigation) | (Write your .m or .mlx scripts here) |
| | |
| | |
+--------------------------+-------------------------------------------+
| Workspace | Command Window |
| (View variables) | _ |
| | (Enter commands here) |
+--------------------------+-------------------------------------------+
  • Toolstrip: The ribbon at the top provides quick access to tools for file management, variable import, layout configuration, and more, organized into tabs like HOME, PLOTS, and EDITOR.
  • Current Folder: This panel acts as a file browser, showing the files in MATLAB’s current working directory. You can navigate your project files here.
  • Editor/Live Editor: This is where you write your code. The Editor is for plain code scripts (.m files). The Live Editor is for creating Live Scripts (.mlx files), which are interactive documents that combine code, formatted text, equations, images, and output in a single, shareable format. Live Scripts are the modern standard for documentation and teaching.
  • Command Window: The interactive console where you can type MATLAB commands, run functions, and see immediate text output. The >> prompt indicates it’s ready for input.
  • Workspace: This panel displays all variables currently in memory. You can inspect their names, values, class, and memory usage. You can also open them in the Variable Editor for a spreadsheet-like view.

For any project beyond a few simple scripts, adopting a structured workflow is essential.

  • MATLAB Projects: Use MATLAB Projects (.prj) to manage your work. A project helps you organize all associated files, manage paths, set startup and shutdown scripts, and easily share your work with others. You can create a new project from the HOME tab.
  • Source Control Integration: MATLAB integrates directly with Git and SVN. You can perform common source control operations like commit, push, pull, and branch directly from the Current Folder panel or the Project tab. This is a best practice for tracking changes and collaborating.
  • The Debugger: The Editor includes a powerful graphical debugger. You can set breakpoints to pause execution, step through your code line-by-line, and inspect the state of variables to find and fix errors.

If you need a free, open-source alternative to MATLAB, GNU Octave is an excellent choice. Its language is largely compatible with MATLAB, and it can run many .m files without modification. However, be aware that there are differences, especially in graphics, advanced toolboxes, and performance. For learning the core language and basic scientific computing, Octave is a highly capable platform.