MATLAB: Missing something obvious? (fscanf)

errorfopenfscanf

Trying to use fscanf to read data from a file that is 24 rows by 5 columns. I've set up this:
[fileId,errorMsg] = fopen('Data.txt', 'r');
if fileId < 0
disp(errorMsg);
else
NUMROWS = 24;
for row = 1:NUMROWS
for col = 1:5
data(row,col) = fscanf(fileId, '%d', inf);
end
end
end
but I keep getting a "Subscripted assignment dimension mismatch." error when I run it. Not sure if I'm missing some obvious error or if I'm just doing this wrong to begin with.
Thanks very much for your help in advance.

Best Answer

If you need to stick to FSCANF, you can do
fid = fopen('Data.txt', 'r') ;
data = fscanf(fid, '%f', [24, 5])
fclose(fid) ;