MATLAB: Textread behaves differently when file resaved

textread

Hello,
I have a not standard format (MRI scanner) file for which I use textread function to read the header. When I use the following command directly on the file, I do not get the full content of the file:
textread('foo','%s', 'delimiter','\n','bufsize', 500000);
However, if I open the file in matlab text editor, make some change, save the file, undo the change and re save it, I get different output (which is correct).
I am assuming there is some problem with the format it was saved originally.
Can anyone help me understand this problem ?
Thanks, Akshay

Best Answer

Couldn't figure out the real reason for the problem, but using textscan in place of textread solved it.