MATLAB Programming/Hello World

Hello World -- MATLABEdit

All programming languages are introduced by the most famous computer program on the planet, "Hello world", so let's begin with that for the time being. Open MATLAB on your computer. You will be greeted by a desktop environment of its own. In the center you can see a window labelled as "Command Window". The cursor should be already flickering there; all you now have to do is to write this...

   disp('Hello world')

and press the return key. The output will be shown just below the command as

   Hello world

So there you have it, a more simple program than in C or C++ we have to call only one function called


and pass the argument string in single quotes (not double), but why so? Because we might need to use double quotes inside the string and that would be interpreted as the end of the string argument. Having said this, it is assured that double quotes work inside the string, however escape sequences may have to be used to get the string right.