필터 지우기
필터 지우기

Extracting histogram each row of matrix

조회 수: 3 (최근 30일)
cem
cem 2019년 5월 11일
편집: madhan ravi 2019년 5월 15일
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
madhan ravi
madhan ravi 2019년 5월 11일
Don‘t name your variable input!!!
Mohsin Shah
Mohsin Shah 2019년 5월 15일
I am also looking for the same solution.

댓글을 달려면 로그인하십시오.

답변 (2개)

Mohsin Shah
Mohsin Shah 2019년 5월 15일
편집: madhan ravi 2019년 5월 15일
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]

gonzalo Mier
gonzalo Mier 2019년 5월 11일
  댓글 수: 1
cem
cem 2019년 5월 12일
I actually read histogram and I could not understand how am I calculate histogram of two element according to others.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by