Finding unique set from large dataset

조회 수: 1 (최근 30일)
Sanjana Sankar
Sanjana Sankar 2019년 7월 18일
댓글: Sanjana Sankar 2019년 7월 19일
Hello!
How would one go about to find a unique set of variables that can depict shortly which variables are used in a large dataset using a matlab code?
For example if the english dictionary is my large dataset, I want the output to be the 26 alphabets-saying these are the unique variables used in your large dataset.
Another example
If x = {"abc", "bcd", "ded"}
I want the output as {"a","b","c","d","e"}
Thanks in advance!

채택된 답변

madhan ravi
madhan ravi 2019년 7월 18일
a = cellfun(@(z)regexp(z,'.','match'),x,'un',0);
Output = num2cell(unique([a{:}]))
  댓글 수: 5
madhan ravi
madhan ravi 2019년 7월 18일
편집: madhan ravi 2019년 7월 18일
Thank you Guillaume :)
Sanjana Sankar
Sanjana Sankar 2019년 7월 19일
Thank you all. I was looking for the output from Guillaume's method. Thanks a lot!!

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

추가 답변 (2개)

Waqar Ali Memon
Waqar Ali Memon 2019년 7월 18일

Bruno Luong
Bruno Luong 2019년 7월 18일
편집: Bruno Luong 2019년 7월 18일
x = ["abc", "bcd", "ded"] % no need using curly bracket for strings
string(unique(cat(2,x{:}))')'

카테고리

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