1.2. Installing MATLAB and Setting Up the Environment
Table of Contents
Overview
In this chapter you will walk through the practical steps of getting MATLAB onto your computer and making sure it is ready to use. You will learn where to get MATLAB, how to install it on different operating systems, how licensing works at a basic level, and how to do the initial setup so that your environment is comfortable and predictable when you start working.
This chapter focuses on installation and the general environment, not on using the MATLAB interface itself. The interface is discussed later in the course.
Getting MATLAB: Licenses and Access
MATLAB is commercial software, so you typically need a license. There are several common ways you might get access.
If you are part of a university or research institution, your organization may provide a campus-wide license. In that case you usually access MATLAB through a portal provided by MathWorks or your institution. Often you log in with your institutional email, which connects to a MathWorks account.
If you work in a company, your employer may have a network or individual license. Your IT department might install MATLAB for you or give you license files.
If you are an individual learner, you can buy a personal license from the MathWorks website or use a trial version. The trial is full-featured for a limited period. There is also a special, lower-cost license for students.
Whatever the source, you will usually need a MathWorks account. This account links your license and lets you download installers, use MATLAB Online, and manage toolboxes.
Downloading the MATLAB Installer
Once you have access, you download the installer from the MathWorks website or an institutional portal. The exact screens you see may vary, but the general idea is similar.
You log in to your MathWorks account, then navigate to the downloads section. There you choose a MATLAB release. A release is a specific version labeled like R2024b or R2023a. For beginners, it is usually best to choose the latest stable release, unless your instructor or organization tells you to use a specific one.
You also choose the installer for your operating system. There are separate installers for Windows, macOS, and Linux. Download the appropriate file to a folder where you can find it easily, for example your Downloads folder.
On Windows you will typically get an executable file, for example matlab_R2024b_win64.exe. On macOS you usually get a .dmg file, and on Linux a compressed archive or installer script.
Installing MATLAB on Windows
On Windows you start by double-clicking the downloaded installer file. Windows may ask for permission to let the installer make changes to your computer, which you must allow.
The installer usually gives you a choice between signing in with your MathWorks account or using a file installation key or license file. For most individual and campus licenses you sign in with your MathWorks account, accept the license agreement, and then choose a license associated with your account.
Next you choose the installation folder. The default path is normally somewhere inside C:\Program Files\ and is fine for most users. You can change it if needed, but keep it somewhere you have permission to access.
Then you select the products to install. MATLAB itself is required, and you may also see many optional toolboxes. For a beginner you can install just MATLAB and a few common toolboxes, or accept a default set if your institution recommends one. You can always add more later.
The installer will then download and install the selected products. This may take some time, depending on your connection and how many toolboxes you selected. When it completes you usually have the option to create a desktop shortcut and a Start Menu entry. Leaving these enabled will make it easier to launch MATLAB later.
Installing MATLAB on macOS
On macOS you open the downloaded .dmg file, which mounts a virtual disk containing the MATLAB installer. You then double-click the installer application.
You will be prompted to sign in with your MathWorks account or use another license method, then to accept the license agreement. The steps are similar to Windows, but the interface will look like a standard macOS installer.
You choose the installation location, which is usually inside the /Applications folder. The installer may ask for your macOS administrator password, because it needs permission to write to protected folders.
Then you select MATLAB and any toolboxes you want, and start the installation. When it is done, you will find MATLAB in the Applications folder. You can drag it to the Dock if you want quick access.
Installing MATLAB on Linux
On Linux you typically start by making the installer script executable, then running it from a terminal. For example, if you downloaded matlab_R2024b_glnxa64.zip you might extract it, then run a script called something like install from the terminal.
The installer will start a graphical interface if your system has a desktop environment. If not, a text-based installer may be used. In both cases you sign in or provide license information, accept the license agreement, and then choose the installation directory, which is often something like /usr/local/MATLAB/R2024b.
You need appropriate permissions, so you might use sudo when running the installer. Then you select MATLAB and toolboxes and complete the installation.
After installation you may need to add a symbolic link or update your path so that you can start MATLAB from the terminal using a simple command like matlab. Your distribution might need extra steps for integration with desktop menus, depending on your environment.
Offline Installation and Network Licenses
In some environments, such as restricted networks, you cannot connect to MathWorks servers during installation. In that case you may use a file installation key, license file, or offline installer provided by your administrator.
With offline installation, you usually point the installer to a folder that contains all product files, either on a local drive or network share. You then select a license file instead of signing in. The installer will skip any online steps and rely on the provided files.
If you use a network license, MATLAB may check out a license from a license server each time it starts. This is often transparent, but it means you may need to be connected to your institution or company network.
Choosing Toolboxes During Installation
MATLAB is the core environment, and toolboxes expand it with specialized functions such as signal processing, image processing, optimization, or statistics. During installation you see a list of toolboxes that your license allows.
For a beginner, it is usually safe to install MATLAB and a few general purpose toolboxes if available, such as Statistics and Machine Learning Toolbox, Signal Processing Toolbox, or Optimization Toolbox. If you are following a course, your instructor may specify exactly which toolboxes to install.
You can always add or remove toolboxes later. To do that, you run the installer again or use the Add-On Explorer within MATLAB to manage products, assuming your license permits the changes.
First Launch and License Activation
After installation, you start MATLAB from the Start Menu on Windows, from Applications on macOS, or from a terminal or application menu on Linux.
On the first launch, MATLAB may prompt you to activate. Activation associates your installation with a particular license and machine. If you signed in during installation, activation may already be completed. If not, MATLAB will guide you through a short activation wizard.
You either sign in, choose your license, or point MATLAB to a license file. Once activation succeeds, MATLAB remembers the information and usually does not ask again unless something changes, such as a major system update or license modification.
If you see activation errors, they may relate to firewall restrictions, incorrect system clocks, or license limits. In those cases, your institution’s IT support or MathWorks support can help.
MATLAB Online as an Alternative
If you cannot install MATLAB on your computer, you may be able to use MATLAB Online. MATLAB Online runs in a web browser, using MathWorks servers instead of your local machine.
To use MATLAB Online, you log in to your MathWorks account and navigate to the MATLAB Online page. If your license includes it, you can launch MATLAB directly without installation.
MATLAB Online has many of the same features as desktop MATLAB, though some hardware dependent features and certain interfaces may differ. It is useful when you are using a Chromebook, a shared computer, or when you cannot install software locally.
Your files in MATLAB Online are stored in your MathWorks Drive, which is cloud storage tied to your account. You can sync or download files when needed.
Basic Environment Preferences
Once MATLAB is installed and activated, it is worth adjusting a few environment settings so that your experience is smoother. These settings are part of your local configuration and do not affect the actual MATLAB language.
You can open the preferences dialog from within MATLAB, usually by selecting Preferences from the Home tab or from a menu such as File > Preferences or a similar option, depending on your operating system. In preferences, you can change fonts, colors, and some behavior of the editor and command window. For example, you can switch between light and dark themes, adjust the font size, and control whether line numbers are shown in the editor.
You can also set your default working folder. The working folder is where MATLAB looks for files and where it saves new files by default. Many users choose a personal projects folder inside their documents so that files are organized in a known place.
The Default Working Folder and Path Basics
When MATLAB starts, it opens in a current folder, sometimes called the working directory. You can see this path at the top of the Desktop interface, near the address bar. Any files in this folder are easy to access without extra configuration.
The MATLAB search path is a list of folders that MATLAB scans when you run a script or function by name. At this stage, you do not need to learn the details of path management, but you should know that if MATLAB cannot find a file you have created, it is often because the file is not in the current folder and not on the path.
You can change the current folder from within MATLAB using the folder browser, the address bar, or commands such as cd. You can also add folders to the path so that MATLAB can find them, using the Set Path dialog or simple commands. Later chapters will show practical examples.
Line Endings, Encoding, and Locale Considerations
MATLAB runs on different operating systems, and each system has its own defaults for text file line endings and character encodings. Here are a few things to be aware of when setting up your environment, especially if you share files with others.
MATLAB handles standard line endings correctly across platforms, so you can move scripts between Windows, macOS, and Linux without problems. Still, you may see differences in how external text editors display them. MATLAB’s editor takes care of this automatically.
For character encoding, MATLAB uses Unicode in modern releases, which supports many languages and special characters. If you use file or folder names with non English characters, or include such characters in comments or strings, you should ensure your operating system locale and MATLAB preferences are consistent.
If you work in a multilingual environment, it may be helpful to check the text encoding settings in MATLAB preferences, especially if you open legacy files created with older encodings.
Integrating with External Tools
When you install MATLAB, some operating systems can associate .m files with the MATLAB editor. This lets you open script files by double-clicking them in your file explorer. During installation or first launch, you may see options to set these associations.
If you also use external editors or integrated development environments, you can still use MATLAB for running and debugging. External tools can call MATLAB as a separate process through commands like matlab -r "myscript" if your system path is set to include the MATLAB executable. These integrations are optional and not required for beginners.
Verifying Your Installation
After MATLAB starts successfully, it is useful to verify that everything is functioning. A simple way is to type a basic command in the command window, such as:
a = 1 + 2
If MATLAB responds with a = 3, your basic environment is working. You can also check your version by typing:
verThis lists your MATLAB version and installed toolboxes. Confirm that any toolboxes you expect to use appear in this list.
You might also create and save a simple script file to verify that MATLAB can read and write in your chosen working folder. For example, create a new script in the editor, type a single line like disp("Hello MATLAB"), and save the file in your working folder, then run it.
Keeping MATLAB Up to Date
MathWorks releases new versions of MATLAB regularly. Within a given release, there may also be updates that fix bugs or improve performance. On many systems MATLAB can check for updates, either automatically or when you select a menu option such as Check for Updates.
For a course, you usually stick with the same major release for consistency. However, applying minor updates within a release can be helpful if they are available. In managed environments, your IT department may control updates, so you follow their policies.
If you update to a new major release, such as from R2023b to R2024a, you usually install the new version alongside the old one rather than overwriting it. Each version lives in its own installation folder, and you can choose which one to run.
Uninstalling or Repairing MATLAB
If you need to remove MATLAB from your system, you use the standard uninstall process for your operating system. On Windows you can use the Apps or Programs settings, on macOS you can remove the MATLAB application from Applications and possibly associated folders, and on Linux you can delete the installation directory and any symbolic links you created.
If something appears broken in your installation, such as missing components or corrupted files, you can often repair it by running the installer again and choosing options to modify or repair. In some cases, it may be easier to uninstall and reinstall, particularly if you do not have many local customizations.
Remember that user files, such as scripts and data saved in your working folders, are separate from the MATLAB installation. Uninstalling MATLAB does not usually remove your own files, but it is always wise to keep your work backed up before major changes.
Key points to remember:
- Always obtain MATLAB from official or authorized sources and link it to your MathWorks account or institutional license.
- Choose the correct installer for your operating system and follow the platform specific steps to install and activate.
- Select MATLAB and only the toolboxes you need, you can add more later if your license allows.
- After installation, verify the setup by running simple commands and checking the version and toolbox list with
ver. - Set a convenient default working folder and adjust basic preferences such as fonts and themes to make your environment comfortable.
Views: 0
Where to Move
Move chapter:
- ☰ 1. Getting Started with MATLAB
- ☰ 1.1. What Is MATLAB and What Is It Used For
- ☰ 1.2. Installing MATLAB and Setting Up the Environment
- ☰ 1.3. Understanding the MATLAB Desktop Interface
- ☰ 1.4. Command Window, Workspace, and Current Folder
- ☰ 1.5. Basic Workflow and Running Simple Commands
- ☰ 1.6. Getting Help and Documentation
-
- ☰ 2. MATLAB Language Basics
- ☰ 2.1. MATLAB Syntax and Expressions
- ☰ 2.2. Variables and Assignment
- ☰ 2.3. Data Types and Type Conversion
- ☰ 2.4. Vectors and Matrices Fundamentals
- ☰ 2.5. Creating and Indexing Arrays
- ☰ 2.6. Basic Arithmetic and Elementwise Operations
- ☰ 2.7. Using Built-In Constants and Functions
-
- ☰ 3. Working with Variables and the Workspace
- ☰ 3.1. Creating, Viewing, and Editing Variables
- ☰ 3.2. Workspace Browser and Variable Inspector
- ☰ 3.3. Saving and Loading Data Files
- ☰ 3.4. MAT-Files and Importing External Data
- ☰ 3.5. Clearing Variables and Managing the Workspace
-
- ☰ 4. Vectors, Matrices, and Arrays
- ☰ 4.1. Row and Column Vectors
- ☰ 4.2. Matrix Creation and Concatenation
- ☰ 4.3. Indexing, Slicing, and Logical Indexing
- ☰ 4.4. Matrix Operations vs Elementwise Operations
- ☰ 4.5. Reshaping and Rearranging Arrays
- ☰ 4.6. Special Matrices and Functions
-
- ☰ 5. Basic Programming Constructs
- ☰ 5.1. Scripts vs Functions
- ☰ 5.2. Control Flow with if, elseif, else
- ☰ 5.3. Loops with for and while
- ☰ 5.4. break, continue, and return
- ☰ 5.5. Logical Expressions and Relational Operators
- ☰ 5.6. Best Practices for Clear and Readable Code
-
- ☰ 6. Functions in MATLAB
- ☰ 6.1. Creating Simple Functions
- ☰ 6.2. Function Inputs and Outputs
- ☰ 6.3. Function Files and the Path
- ☰ 6.4. Local vs Global Variables
- ☰ 6.5. Anonymous Functions
- ☰ 6.6. Organizing Code into Multiple Functions
-
- ☰ 7. Working with Numbers and Math
- ☰ 7.1. Scalars and Vectorized Computations
- ☰ 7.2. Basic Mathematical Functions
- ☰ 7.3. Trigonometric and Exponential Functions
- ☰ 7.4. Complex Numbers in MATLAB
- ☰ 7.5. Rounding, Modulo, and Special Values
- ☰ 7.6. Numerical Precision and Floating Point Considerations
-
- ☰ 8. Strings, Characters, and Categorical Data
- ☰ 8.1. Character Arrays and String Arrays
- ☰ 8.2. Creating and Manipulating Strings
- ☰ 8.3. Converting Between Data Types and Strings
- ☰ 8.4. Comparing and Searching Strings
- ☰ 8.5. Categorical Arrays Basics
-
- ☰ 9. Tables, Structures, and Cell Arrays
- ☰ 9.1. Introduction to Tables
- ☰ 9.2. Creating Tables and Accessing Data
- ☰ 9.3. Modifying and Joining Tables
- ☰ 9.4. Structures and Nested Structures
- ☰ 9.5. Cell Arrays and Cell Indexing
- ☰ 9.6. Choosing the Right Container Type
-
- ☰ 10. Importing and Exporting Data
- ☰ 10.1. Reading Text and CSV Files
- ☰ 10.2. Importing Excel Spreadsheets
- ☰ 10.3. Importing Data with the Import Tool
- ☰ 10.4. Exporting Data to Files
- ☰ 10.5. Working with Image and Audio Files
- ☰ 10.6. Basic File Management from MATLAB
-
- ☰ 11. Plotting and Visualization
- ☰ 11.1. Introduction to 2D Plotting
- ☰ 11.2. Customizing Plots and Axes
- ☰ 11.3. Multiple Plots in One Figure
- ☰ 11.4. Labels, Titles, Legends, and Annotations
- ☰ 11.5. Plotting with Different Line and Marker Styles
- ☰ 11.6. Saving and Exporting Figures
-
- ☰ 12. Advanced Plotting for Beginners
- ☰ 12.1. Subplots and Tiled Layouts
- ☰ 12.2. Bar, Scatter, and Stem Plots
- ☰ 12.3. Histograms and Density Plots
- ☰ 12.4. 3D Plots and Surface Plots
- ☰ 12.5. Using plottools and Interactive Editing
- ☰ 12.6. Basics of Handle Graphics
-
- ☰ 13. Working with Scripts and Live Scripts
- ☰ 13.1. Creating and Running Script Files
- ☰ 13.2. Sectioning Code and Running Sections
- ☰ 13.3. Live Scripts and Rich Text
- ☰ 13.4. Adding Equations, Images, and Outputs
- ☰ 13.5. Sharing and Exporting Live Scripts
-
- ☰ 14. Debugging and Code Quality
- ☰ 14.1. Finding and Fixing Syntax Errors
- ☰ 14.2. Setting Breakpoints and Stepping Through Code
- ☰ 14.3. Inspecting Variable Values During Execution
- ☰ 14.4. Using the Editor Debugging Tools
- ☰ 14.5. Using Code Analyzer and Warnings
- ☰ 14.6. Writing Clean and Maintainable MATLAB Code
-
- ☰ 15. Basic Linear Algebra with MATLAB
- ☰ 15.1. Vectors and Norms
- ☰ 15.2. Matrix Addition and Multiplication
- ☰ 15.3. Solving Linear Systems with Backslash
- ☰ 15.4. Inverses, Determinants, and Rank
- ☰ 15.5. Eigenvalues and Eigenvectors
- ☰ 15.6. Using Linear Algebra Functions Safely
-
- ☰ 16. Data Analysis and Statistics Fundamentals
- ☰ 16.1. Descriptive Statistics and Summary Measures
- ☰ 16.2. Sorting, Filtering, and Grouping Data
- ☰ 16.3. Basic Correlation and Regression
- ☰ 16.4. Simple Data Cleaning Techniques
- ☰ 16.5. Basic Time Series Handling
-
- ☰ 17. Working with Time and Dates
- ☰ 17.1. Representing Dates and Times
- ☰ 17.2. Creating and Formatting datetime Arrays
- ☰ 17.3. Date Calculations and Differences
- ☰ 17.4. Plotting Data over Time
-
- ☰ 18. Introduction to Signal and Image Handling
- ☰ 18.1. Basic Signal Representation in MATLAB
- ☰ 18.2. Simple Filtering and Transformations
- ☰ 18.3. Reading, Displaying, and Writing Images
- ☰ 18.4. Basic Image Transformations
-
- ☰ 19. Automation and Scripting Tasks
- ☰ 19.1. Batch Processing of Files
- ☰ 19.2. Writing Reusable Utility Scripts
- ☰ 19.3. Using Relative Paths and the MATLAB Path
- ☰ 19.4. Simple User Interaction with input and disp
-
- ☰ 20. Introduction to Toolboxes
- ☰ 20.1. What Are Toolboxes and How to Use Them
- ☰ 20.2. Exploring Installed Toolboxes
- ☰ 20.3. Finding Functions in Toolboxes
- ☰ 20.4. Add-Ons and MATLAB File Exchange
-
- ☰ 21. Best Practices and Next Steps
- ☰ 21.1. Organizing Projects and Folders
- ☰ 21.2. Version Control Basics with MATLAB
- ☰ 21.3. Performance Tips for Beginners
- ☰ 21.4. Learning Resources and Documentation Path
- ☰ 21.5. Suggested Practice Projects for Beginners
-
Comments
Please login to add a comment.
Don't have an account? Register now!