I have a text file with the input as
sammy yo yoyoyo with youSamyukta
and I tried the following code to put each word into an element of an array.
fid = fopen('test4.txt');table = fscanf(fid,'%c');table2 = regexp(table,'\n','split');
this means that when I refer to table2{1}, it returns 'sammy yo yo' then I split every line individually with strsplit and ' ' (whitespace) as the delimiter. Therefore, when I refer to table2{1}{2} , it returns 'ýo'. But, the last word of every line has more number of letters than appears i.e. size(table2{1}{2},2) = 3 rather than 2. But when I strcmp it with '\n' and ' ' or any other thing, it returns 0. So now I don't know what to do.
Best Answer