From: Chun-Chieh on
Hi all:

Thanks for suggestion. I tried this commend:
fid = fopen('d:\test.txt');
c = textscan(fid,'%ssamples =%d%*[^\n]','headerlines',2)

I tried to skip to the first 2 lines which is known, and search the string "samples =" and read the number next to this string. The return is always like this:

c =

{1x1 cell} [0x1 int32]

Why I used textscan is because I know some certain string exists in the file and I need to get the number right after the string. Since there are hundreds of such files and the new files are coming, I can't open each one manually and write the numbers down. I tried fgetl(fid) and it returned the second line as a text string. So what should I do?

Thank you again for your help.