From: Oleg Komarov on
"Hadassa Brunschwig" <hadassa.brunschwig(a)mail.huji.ac.il> wrote in message <hj4jj0$88v$1(a)fred.mathworks.com>...
> Hi
>
> I have a large file of about 2000 rows and many more columns.
> I want to sort the rows in this file according to a new index I have created.
> That is, I actually do not care about the format of the values or the values
> when I read in the file. I would just like to read it in, sort it and write it back
> into the same file.
> I attempted something like
> fid = fopen('filetoread.txt','r');
> cs = fscanf(fid, '%d\n');
> fclose(fid);
> (and then sortrows etc.)
> But fscanf of course ignores the '\n' and the rows are then lost.
>
> Thanks for any comments.
>
> Hadassa
Try with \r or \r\n instead of only \n.

Oleg