# Category:Programming language:MATLAB

If you need help from other users with a program written in MATLAB, take a look at Category:Users:MATLAB:Experts, Category:Users:MATLAB:Knows, and possibly Category:Users:MATLAB:Some.

MATLAB is a programming language distributed by The MathWorks. The opensource language Octave is mostly compatible with MATLAB.

Please note that the name of this language is "MATLAB", unhyphenated in all-upper case, not "matlab", "MAT-LAB" or "MATHLAB".

• Programming
• Statistics
• Finance

## Tips and Tricks

A lot of tricks in MATLAB are targeted to avoid loops using linear algebra or matrices manipulations. A very good tutorial to such tricks in MATLAB array manipulation tips and tricks, by Peter J. Acklam.

### Simple example: Count occurences

Example: counting occurences in an array.

```<<count_elements.m>>=
function frequency_table = count_elements(vectr)
% COUNT_ELEMENTS - fast and efficient way to count different
%  elements in an array of integers.
%
% Example:
%  v = round(rand(300,1)*20);
%  f = count_elements(v)
%
[keys,idx,jdx]  = unique(vectr);
frequency_table = struct('keys',keys,'value',sparse(jdx,1,1));
```

### Remove diagonal elements

Following an interesting answer on the newsgroup.

```<<remove_diagonal.m>>=
m=magic(5)
r=reshape(m(~eye(size(m,2))),size(m)-[1,0])
```

## Literate Programming

• The section Literate programming tools (MATLAB) gives some MATLAB code to be used with LP.org, with a special OCAMAWEB Lite version in MATLAB.
• OCAMAWEB is a free Literate Programming tool for MATLAB and some other languages.

• blogs of MATLAB workers
• Data Mining in MATLAB
• MATLAB at en.wikipedia
• MATLAB toolboxes list
• The Origins of MATLAB by Cleve Moler, one of the creators of MATLAB
• Share MATLAB Code Snippets

## Subcategories

There is 1 subcategory to this category.

## Articles in category "Programming language:MATLAB"

There are 17 articles in this category.