find, change and plot a txt file
이전 댓글 표시
i have a txt with 8600 words and i have to delete words that are 3 letters or less and words with special characters. then i have to do a plot of those words. how can i do that? i dont know how to start
답변 (1개)
Rik
2021년 11월 19일
0 개 추천
Break it up into tasks you either know how to do, or for which you can google a solution.
So first: how can you read a text file to a Matlab variable? I would suggest using my readfile function, which you can get from the FEX. This will deal with UTF-8 text files properly.
Next step: delete some specific words. Using cellfun is an option, but it will only hide the loop, not remove it. So a loop it is. What do you need to do? For each word you need to find out the number of elements and whether it contains a special character. What do you define as a special character? Is é a special character?
Plotting words is a bit more tricky. What do you mean? Do you want a word cloud? There are probably people who have already posted code on the File Exchange that will do something like that. Or do you want something like a Hamming tree (I don't know if that is the official name)? If you can sketch it, there is probably a way to create it with Matlab.
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!