Hello World in Matlab

Published on 11 April 2018 (Updated: 15 May 2023)

Welcome to the Hello World in Matlab page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

disp('Hello, World!');

Hello World in Matlab was written by:

This article was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

Syntax in MATLAB is based on its MATLAB scripting language.

One line is all it takes! The "details-hidden" nature of the languages removes the need to declare variables or classes before the fun begins. disp is the command in MATLAB that formats data and displays it in the command window. In this case, the data is the string "Hello, World!" (denoted by the quotations).

How to Run the Solution

Running our program is a relatively simple affair. First, the script must be saved using the MATLAB editor. File > Save or CNTL+S will do the trick, and it will generate a file with the extension *.m (yep, only one character). After that, hit run and watch as our polite greeting to our surroundings populates the screen.

If you want to try this out yourself, you can get a 30 day free trial of MATLAB, download the program sample file and run the script! Note, if you are a university student, your school may have licenses of MATLAB available to you.

Alternatively, you can try to use Octave Online, an open-source alternative to MATLAB. According to its wiki page, Octave is mostly compatible with MATLAB. In fact, our solution to Hello World in MATLAB works great.