How can i remove from a cell array, the words in another cell array?
1 次查看(过去 30 天)
显示 更早的评论
I want to remove the words I have in stopWords(attached) from the words in another cell array newWords(attached). Is there any way I can do this?
0 个评论
回答(1 个)
Star Strider
2020-4-15
Try this:
D1 = load('stopWords.mat');
stopWords = D1.stopWords;
D2 = load('newWords.mat');
newWords = D2.newWords;
editedWords = cellfun(@(x,y)setdiff(x,y,'stable'),{newWords},stopWords, 'Unif',0); % (1x1) Cell Array (305x1) Cell
editedWordsList = editedWords{:}; % (305x1) Cell Array
It appears to produce the correct result (‘editedWordList’), although I did not examine it closely.
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!