A grouping vector numbers
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello friends I have one matrix and I need assemble all entries of a matriz in one single vector. This I've done. But I need i need extract repeated values of this and put them in new one. For this I need construct a histogram, and verify which values who not equal to zero and increment a count. So if I find a value not equal to zero I have to increment +1 to value (color) in the histogram position. with intervals100 or 200 to perform small increment in the same "color" (value) on vector
A=[1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0;1 2 3 4 5; 2 3 4 5 5; 6 7 8 9 0]
v = reshape( A.' ,1,numel(A));
0 Commenti
Risposte (2)
dpb
il 19 Giu 2014
I can't really parse the request but on an off chance it'll help...
BTW, the shortcut for reshape(x,1,[]) is
v=A(:); % this works for all array sizes to generate a column vector
Anyway, as said, taking a guess on the question...
n=histc(v,unique(v));
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Distribution Plots 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!