fscanf function - file function:
The fscanf reads matrix variable mat columnwise from the file specified by fid. The 'format' involves conversion characters much similar to those used in the fprintf function. The dimensions identify the preferred dimensions of mat; if the number of values in the file is not known, inf is used for the second dimension. For illustration, the below would read in the similar file identified earlier, that has on each line a number, then a space, then a character.
>> fid = fopen('subjexp.dat');
>> mat = fscanf(fid,'%f %c',[2 inf])
5.3000 2.2000 3.3000 4.4000 1.1000
97.0000 98.0000 97.0000 97.0000 98.0000