# Tricks of the Trade in matlab

• run matlab on Linux server with matlab -nodesktop -nodisplay -nosplash -nojvm. To run a script, you just need to type the script name without the extension name. e.g: test.m by test.
• numel() to check whether the input image is RGB image or grayscale image. repmat() to convert the grayscale image into pseudo RGB image.
• fread() to calculate file content line number. Note that most file content is line-breaked by '\n'. The ASCII code of '\n' is 10. That is, we can directly count the number of '\n', which equals to line number.
fread() reads the file in binary stream, '*char' means reading a char each time and outputing as char too.