Finding unique set from large dataset

7 Ansichten (letzte 30 Tage)
Sanjana Sankar
Sanjana Sankar am 18 Jul. 2019
Kommentiert: Sanjana Sankar am 19 Jul. 2019
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!

Akzeptierte Antwort

madhan ravi
madhan ravi am 18 Jul. 2019
a = cellfun(@(z)regexp(z,'.','match'),x,'un',0);
Output = num2cell(unique([a{:}]))
  5 Kommentare
madhan ravi
madhan ravi am 18 Jul. 2019
Bearbeitet: madhan ravi am 18 Jul. 2019
Thank you Guillaume :)
Sanjana Sankar
Sanjana Sankar am 19 Jul. 2019
Thank you all. I was looking for the output from Guillaume's method. Thanks a lot!!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Waqar Ali Memon
Waqar Ali Memon am 18 Jul. 2019

Bruno Luong
Bruno Luong am 18 Jul. 2019
Bearbeitet: Bruno Luong am 18 Jul. 2019
x = ["abc", "bcd", "ded"] % no need using curly bracket for strings
string(unique(cat(2,x{:}))')'

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by