hello,
i have a string, x= 'with all this stuff going down at the moment '
i want to remove words - with,all,this,at,the
and generate a new string so that i can feed only the important words into the RNNs.
x= 'stuff going down moment'
How can I do it?
Thank You

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 29일
편집: Ameer Hamza 2020년 10월 29일

1 개 추천

Try erase()
str = 'with all this stuff going down at the moment ';
words_to_remove = {'with ','all ','this ','at ','the '};
new_str = erase(str, words_to_remove)
Or if you have several words to remove, making it difficult to make a words_to_remove cell array manually
str = 'with all this stuff going down at the moment ';
words_to_remove = 'with,all,this,at,the';
words_to_remove = cellfun(@(x) {[x ' ']}, strsplit(words_to_remove, ','));
new_str = erase(str, words_to_remove)

댓글 수: 2

REN Jain
REN Jain 2020년 10월 30일
Thank You once again. :)
Ameer Hamza
Ameer Hamza 2020년 10월 30일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2020년 10월 29일

댓글:

2020년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by