User:MrAlanKoh/sandbox

Test MATLAB Programming Markup Language

>> Test('Test')


 * Need two spaces and >>

>> Test('Test')

Using the command line to call functions
The command line can be used to call any function that's in a defined path. To call a function, the following general syntax is used:

>> [Output1, Output2, ..] = functionname(input1, input2,..)

MATLAB will look for a file called functionname.m and will execute all of the code inside it until it either encounters an error or finishes the file. In the former case, it produces a noise and displays an error message in red. In the latter case, MATLAB will relinquish control to you, which you can see when the >> symbol is visible on the bottom of the workspace and the text next to "start" button on the bottom-left of the screen says "ready".

Use this in order to call homemade functions as well as those built into MATLAB. MATLAB has a large array of functions, and the help file as well as this wikibook are good places to look for help on what you need to provide as inputs and what you will get back.

Be careful; the syntax for functions and for indexing arrays is the same. To avoid confusion, just make sure you don't name a variable the same as any function. To ensure this, type the name of the variable you want to define in the command prompt. If it tells you:

Error using ==> (functionname) Not enough input arguments.

then you'll have a conflict with an existing function. If it tells you:

??? Undefined function or variable '(functionname)'

you'll be OK.