I have a text file in the following format : Algorithm SNR Q A 20 30 25 32 30 35 B 20 32 25 34 30 36
I want to read this data of SNR and Q for 2 different algorithms so that i can plot SNR vs Q graph.
But the problem is that when I read this text file using Matlab functions (example textscan) , it doesn't read it correctly due to the empty spaces present in this text file in the column 'Algorithm'. For example: I tried to open this text file and read it and then display its contents :
fid = fopen('Test.txt'); C = textscan(fid,'%s %d %f');fclose(fid);celldisp(C);
The output of the above code is :
C{1}{1} = Algorithm C{2} = [] C{3} = []
If I remove the first column named 'Algorithm' from the text file and then read that file, then it works fine. But I am unable to read it correctly when that String column is also present. Can anyone please help me to know how can I read such data correctly from a text file. Thanks for your help in advance.
Best Answer