Log in to one of HUT's unix workstations in the normal manner. Then, to start the program, give the commands:
use matlab matlab
If you are accessing the computer over a slow Internet connection (from some other X11-capable workstation) or you just don't like Matlab's rather slow and cumbersome graphical interface you can also start is as:
use matlab matlab -nojvm -nosplash
Then only the images will be displayed in separate windows, the commands will be given directly in the terminal.
Commands can be given at the ">>" prompt or can be written into functions. Each command is limited to one line unless three consecutive periods are given which signifies the continuation of a line. End the command with a semicolon ";" unless you want the result of the expression to be printed out.
A list of some useful Matlab commands can be found here:
To get started, experiment with simple expressions first and then try more advanced commands.
It is often useful to write commands into functions. A function is a text file (with the filename extension ".m") which as a first line contains something like
function x=fname(var1, var2)
Of course the arguments and the returned variable can have any names, and 'fname' is the name of the function (should be in file 'fname.m'). The rest of the file contains standard Matlab commands which eventually give the returning variable its value. You may then call the function from the prompt (or some other function) e.g. like this
>> y = fname(7, 3) ans = 21 >>
Use the Image Processing Toolbox 'imread'. Help on this function can be found by typing 'help imread'. The function accepts most standard image file formats.
>> I=imread('mypic.tif','tif'); >> I=double(I);
Note the second row, where we convert to image to floating point (double precision) format! This is very important if you are going to do any arithmetic operations, since the original 8-bit integer format cannot for example express large or negative numbers. This can also be done in one line only:
Having read the image into the matrix 'X', you can display it by
>> figure; colormap(gray(256)); image(X);
There is another command called 'imagesc', which adjusts the scaling such that the smallest element of X becomes black and the largest white.
This can be done directly from the image figure, using the menu commands. Be sure to direct it to the correct printer. Another way is of course to save it to a file (using 'imwrite') first.
Page maintained by t615100 at cis.hut.fi, last updated Tuesday, 23-Oct-2007 12:21:23 EEST