Hi,
It might be an unappropriate way to format string using specifiers inside fopen. Instead you can try specifying filename seperately inside for loop and give that as input to fopen.
for i = 1:30
filename = sprintf('%d.asc', i);
fid = fopen(filename, 'r');
fclose(fid);
end