A grouping vector numbers
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
dpb
2014년 6월 19일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!