필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to Design logic for grouping of variables

조회 수: 1 (최근 30일)
Atinesh Singh
Atinesh Singh 2017년 4월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
Suppose we have a variable called 'group' which contains grouping information
group = [ {1}, {2}, ..., {D} ]
We have to maintain a counter for every pair (i, j) where i, j are in the range [1 D] and for all those pairs whose count(i, j) >= 5, these pairs are merged.
Example:
D = 5
group = [ {1}, {2}, {3}, {4}, {5} ]
(1, 2) = 7
(2, 3) = 10
(3, 4) = 2
(4, 5) = 20
hence pairs are merged and the resultant group is
group = [ {1 2 3}, {4 5} ]
in my problem D can have a value of 1000, what is the efficient way to implement this logic
  댓글 수: 1
Stephen23
Stephen23 2017년 4월 26일
편집: Stephen23 2017년 4월 26일
I get the feeling that this is part of a larger task, which possibly could be efficiently solved using accumarray. You should read these: http://xyproblem.info/

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by