Multi level sorting and filtering

조회 수: 3 (최근 30일)
Mekala balaji
Mekala balaji 2015년 1월 17일
댓글: Mekala balaji 2015년 1월 17일
Dears,
I have original data in Table1 and want to do multilevel sorting and filtering to remove repeated data and finally get unique data as in Table2. Please some one help me how to get Table2 data from Table1.
My sincere thanks in advance, Mekala

답변 (1개)

Shoaibur Rahman
Shoaibur Rahman 2015년 1월 17일
편집: Shoaibur Rahman 2015년 1월 17일
[~, ~, D] = xlsread('Multilevel_sorting.xlsx');
A = D(3:end,1:2); % your data in table 1
G = {'Group1','Group2','Group3','Group4','Group5'};
for k = 1:numel(G)
B{k} = A(strcmp(A(:,2),G(k)));
B{k} = [G(k); unique(B{k})]; % remove G(k) if you don't need the Group headers
end
B is your table 2. To see the elements in B, just type B{1} for Group1, B{2} for Group2 and so on.
  댓글 수: 1
Mekala balaji
Mekala balaji 2015년 1월 17일
Sir,
I do not want to define the groups (assuming it is unknown). I Want write code to filter by uniqueness, and then I want store under each unique cell in column2 in table1, how many unique cells are present in column1.
Sincerely, Mekala

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by