A grouping vector numbers
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
dpb
on 19 Jun 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 Comments
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!