find, change and plot a txt file
1 view (last 30 days)
Rik on 19 Nov 2021
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.