Hi, I have a cell array (P) of size 5000x1. Each element of this cell array is another cell array of variable size which contains some words. The task is to find the words that are present in more than a certain number of elements (rows) of the array P. Thanks

1 commentaire

John D'Errico
John D'Errico le 28 Oct 2017
What have you tried? If nothing, then why not? If you want help, show what you have done. Otherwise this becomes merely a doit4me.

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 29 Oct 2017

0 votes

Hint: You are not told which orientation the individual cell arrays are. You need to make them all the same orientation before you can get much further.
bar = cellfun(@(C) C(:), foo, 'uniform', 0);
Then you can pull all of the contents into a single array:
vertcat(bar{:})

3 commentaires

Mahmoud Zeydabadinezhad
Mahmoud Zeydabadinezhad le 29 Oct 2017
Modifié(e) : Walter Roberson le 29 Oct 2017
I did this:
temp = cellfun(@unique, train,'UniformOutput',false);
all_words = vertcat(temp(:));
But the all_words is the same as temp and that's not what I wanted.
Walter Roberson
Walter Roberson le 29 Oct 2017
Notice I wrote vertcat(bar{:}) -- pay attention to brackets.
Mahmoud Zeydabadinezhad
Mahmoud Zeydabadinezhad le 29 Oct 2017
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by