From: Matt Fig on
What do you mean list all the rows? Can't the original matrix itself be seen as a list of all the rows? Do you mean list all rows without repeats listed? Look at the UNIQUE function, or if you want to combine this with the previous engine, put this in there:

B = sortrows(A);
S = [1;any(diff(B),2)];
Bu = B(logical(S),:); % List the unique elements of B
.....
From: Oleg Komarov on
Approach with unique:
[a,b,c] = unique(A,'rows');
% The last column lists the counts
[a accumarray(c,1)]

Oleg
From: Jack on
"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <i0hmm1$8hh$1(a)fred.mathworks.com>...
> Approach with unique:
> [a,b,c] = unique(A,'rows');
> % The last column lists the counts
> [a accumarray(c,1)]
>
> Oleg


Oleg; Thanks a lot; this was an easy code "to understand". The "unique" function is new for me.

Matt; thanks for intorducing me to the difficult ways of using matlab :) but seriously I learned a lot from your code.
From: Jack on
"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <i0hmm1$8hh$1(a)fred.mathworks.com>...
> Approach with unique:
> [a,b,c] = unique(A,'rows');
> % The last column lists the counts
> [a accumarray(c,1)]
>
> Oleg

One more question here;
how can I make the code counts rows [a,b,c] read the same in both directions as one single row (either one of the two). For example when after applying Oleg's code we get 3 4 5 6 which means 3 4 5 count is 6 and we get another row 5 4 3 10, then because 3 4 5 is read 5 4 3 in the opposite direction I want the code to give me 3 4 5 16 only ( or 5 4 3 16 only but noth both) where the 16 is the sum of two counts.

Thanks a lot