A00.m - Hello World

disp('hello world')
x = 1+1

Download A00.m

This Matlab program prints "hello world" to the command window, calculates 1+1, stores the result in variable x and then prints the result (i.e. 2) to the command window. It just doesn't get any simpler than this.

The command disp is short for "display" and may be used to display text or variables to the command window. Note the use of single quotes around the text. Double quotes will give an error.


Monkey Home   |    Prev   |   Next