|
From: | Abhinav Tripathi |
Subject: | Re: test needed - fileread and line endings |
Date: | Fri, 1 Jul 2016 00:39:39 +0530 |
On Jul 1, 2016 12:30 AM, "Mike Miller" <address@hidden> wrote:
>
> Can someone test the following for me in Matlab? I'm interested in the
> output on both Windows and Unix-like systems.
>
On Matlab2013a on Windows 10 I get:
> fid = fopen('foo.txt', 'wb');
> fprintf(fid, 'a\nb\n');
> fclose(fid);
> fid = fopen('bar.txt', 'wb');
> fprintf(fid, 'a\r\nb\r\n');
> fclose(fid);
> info = dir('foo.txt');
> info.bytes
ans = 4
> info = dir('bar.txt');
> info.bytes
ans = 6
> s = fileread('foo.txt');
> double(s)
ans = 97 10 98 10
> s = fileread('bar.txt');
> double(s)
ans = 97 13 10 98 13 10
>
> --
> mike
>
.
Abhinav
[Prev in Thread] | Current Thread | [Next in Thread] |