1. Getting Started with MatLab - Arduinerd/PDS-MatLab GitHub Wiki

MatLab stands for Mathematical Laboratory and is the application typically used in most engineering fields. It is capable of performing functions similar both to a programming language and an advanced calculator. In addition to the functionality built into the system, there are many toolboxes to install.

Getting MatLab

MatLab can be downloaded from mathworks.com. Depending on your needs you can either buy a full subscription or use it for free in a one-month trial period. (That is what I used for this tutorial).

The version used for this tutorial was R2018a. "R" stands for release and "a" refers to the first of the two releases in a year.

You will need administrator priveledges in order to download the application, so ask a teacher before putting it on a school computer.

Opening MatLab GUI for the First Time

Upon downloading and running the installer for MatLab, you should be looking at a window like this:

MATLAB GUI

There are only three tabs in the ribbon at the top of the screen, but more will appear depending on the commands executed

Exploring the User Interface

While MatLab is a language, it supports a graphical user interface (GUI) in order to help with coding and computation. Note that any interactions done by the GUI can be viewed and executed as commands from the command window.

Ribbon

HOME Tab

HOME TAB

  • File Tools
    • New (Creates new instances of anything possible due to downloaded content)
    • Open (Opens files, including recent ones)
    • Compare Files (Compares files line by line)
    • Find Files (search directories for files)
  • Variable Tools
    • Import Data (Select files to upload and create variables from)
    • Save Workspace (Creates a file which contains current session information)
    • New Variable (Creates new variable from a user-specified table)
    • Edit Variable (Opens variable values and displays them in table format)
    • Clear Workspace (Deletes all initialized variables)
  • Code Tools
    • Favorite Commands (Lists favorite commands)
    • Analyze code (Lists suggestions to improve code within open files)
    • Run and Time (Records runtime for a script)
    • Clear Commands (Clears Command window but does not erase Workspace or Command History)
  • Environment Tools
    • Layout (Set/save window arrangement)
    • Preferences (Open MatLab GUI preferences for access to attributes like text size and etc)
    • Set Path (Sets the current file directory to find MatLab files)
    • Parallel (For parallel computing and use of more than one core - not needed unless doing many iterations within code)
  • Resources
    • Help (Links to documentation and support sites)
    • Community (Opens browser page to MathWorks public site)
    • Request Support (Submit an official request to MathWorks)
    • Learn MatLab (Opens browser page to MathWorks tutorials)

PLOTS Tab

PLOTS TAB

The plots tab will display every available type of graph. In order to graph a value, you must first select a variable in the workspace. The GUI will automatically display the graphs in order of applicability. By clicking the desired graph you will actually be triggering a command to be executed in the command window. This is discussed in more detail in Section 4.

APPS Tab

APPS TAB

Apps are grouped into packages and by clicking the down arrow you will see every available app. At the top of the list will be the favorites which can be managed by clicking the star next to the icon.

By opening an app you will be shown a new window which allows for more advanced computation and analysis.
Standard App Groups Include:

  • Machine Learning
  • Math, Statistics, and Optimization
  • Control System Design and Analysis
  • Signal Processing and Communications
  • Image Processing and Computer Vision
  • Test and Measurement
  • Computational Finance
  • Database Connectivity and Reporting

You may also choose to write your own app, but that is not included in this tutorial.

Windows

Current Folder

  • Shows current path and files within the folder
  • Full path is specified

Workspace

  • Display current variables and their values
  • If the type is array, it will show the min and max
  • By right clicking, you can add more properties to the variables

Command Window

  • Whatever is typed is evaluated
  • Putting a “;” at the end of a statement to hide evaluation on window
  • Up and down keys cycle through command history displayed in “Command History“ window

Command History

  • Displays all commands entered
  • Selecting past commands will open options to create shortcuts (Creating one will open the SHORTCUTS tab on the ribbon)

Window Layouts

  • By clicking and dragging the top of the window you can rearrange the panels within the GUI.
  • The down arrow in the upper right-hand corner of a window gives the option of undocking the window from the screen
  • Window layouts can be saved within the HOME tab in the Environment Tools PICTURE