how to count for whitespace symbol occurrences in a .txt file?
Show older comments
i found a way to read the .txt file and count the symbols using this code:
v=textread('FF7.m','%c'); count=length(strfind(v,'(symbol)'));
but i cant find a way to count the whitespaces, space, breaks, or tabs. in addition, since the input should be in script, i cant put the single quotation in the script. i also need to count the ' symbol.
can someone help me? any help will be very appreciated. thank you in advance!
Accepted Answer
More Answers (1)
Walter Roberson
on 9 Mar 2013
'''' is a quoted single-quote.
You may wish to consider using ismember().
Also,
newline = sprintf('\n');
cr = sprintf('\r');
tab = sprintf('\t');
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!