MATLAB is a matrix laboratory, providing high-performance numeric computation and data visualization with an emphasis on standard matrix manipulations. MATLAB is designed for ease of use, and its operations and commands resemble the mathematical notation commonly used with matrices.
On some systems, you will need to load the matlab module into your path prior to running matlab. You can do so with the following:
host% module load matlab
If you plan to use a non-default version, you will need to specify the version you wish to use. Available versions can be found with:
host% module avail matlab
Once you have logged in, and before beginning MATLAB, you may wish to create a directory for holding your MATLAB files. The following example shows how to create in your home directory a subdirectory named 'matlab':
host% mkdir ~/matlab
host% cd ~/matlab
Once the module is loaded, invoke MATLAB with:
host% matlab
After a few moments, the appearance of the MATLAB prompt '>>' indicates that MATLAB is ready and awaiting your commands. You could enter your commands one at a time, as in the following example:
>> A = [1 2 3; 4 5 6]
>> B = [7 8; 9 10; 11 12]
>> C = A*B
or alternatively, you could write these commands to a file, named as you please, but ending with '.m', then give the filename at the MATLAB prompt. If you created a file named matmult.m, for example, with the same commands as given above, then entering:
>> matmult
would cause MATLAB to read and execute those same commands with the same result: storing in matrix C the product of matrices A and B, and displaying the contents of each matrix.
Use of these M-files saves you from having to reenter your commands repeatedly. If you wish to access an M-file in a directory other than your current working directory, then enter:
(csh, tcsh) host% setenv MATLABPATH /desired/subdirectory
(bash, ksh) host% export MATLABPATH=/desired/subdirectory
To quit MATLAB, use the command:
>> exit
Note that exiting MATLAB in any other manner can leave MATLAB running.
>> demo
>> help
host% man matlab
Arctic Region
Supercomputing Center
PO Box 756020, Fairbanks, AK 99775 | voice: 907-450-8600 | email:
home | search | about | support | news | science | resources