# Extracting histogram each row of matrix

3 visualizzazioni (ultimi 30 giorni)
cem il 11 Mag 2019
Modificato: madhan ravi il 15 Mag 2019
Hi Everyone,
I have a matrix name as input:
A = [0 4; 0 -5; 0 -1; 0 -1; 2 -1; 3 3; 2 4; 4 0; 0 1; 0 -2; 0 -1; 0 -1; 0 -1;2 -1;2 -1;3 3; 2 4; 4 0];
I want to extract histogram analysis each row of "input" according the other rows. I actually wonder frequency of each row according to other rows. How can i do that without a loop?
##### 2 CommentiMostra NessunoNascondi Nessuno
madhan ravi il 11 Mag 2019
Mohsin Shah il 15 Mag 2019
I am also looking for the same solution.

Accedi per commentare.

### Risposte (2)

Mohsin Shah il 15 Mag 2019
Modificato: madhan ravi il 15 Mag 2019
I hope this will solve your problem.
A = [0 4; 0 -5; 0 -1; 0 -1; 2 -1; 3 3; 2 4; 4 0; 0 1; 0 -2; 0 -1; 0 -1; 0 -1;2 -1;2 -1;3 3; 2 4; 4 0];
[Mu,ia,ic] = unique(A, 'rows', 'stable');
% Unique Values By Row, Retaining Original Order
h = accumarray(ic, 1); % Count Occurrences
maph = h(ic); % Map Occurrences To ‘ic’ Values
Result = [A, maph]
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

gonzalo Mier il 11 Mag 2019
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
cem il 12 Mag 2019
I actually read histogram and I could not understand how am I calculate histogram of two element according to others.

Accedi per commentare.

### Categorie

Scopri di più su Histograms in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by