Large Ascii Files and "textread.m"

Ben Abbott bpabbott at mac.com
Mon Jul 7 15:34:48 CDT 2008


 
On Monday, July 07, 2008, at 04:06PM, "Michael Barton" <bartonm09 at gmail.com> wrote:
>Functions fgets and fgetl work; however, I can't get the following strings
>read in.

There's not enough context to figure out what is wrong, but the code below does what you want.

fid = fopen ("test.txt");
line = {};
line{end+1} = fgetl (fid);
line{end+1} = fgetl (fid);
line{end+1} = fgetl (fid);
fclose(fid);
line
line =

{
  [1,1] = This is the 1st line of the file.
  [1,2] = This is the 2nd line of the file.
  [1,3] = This is the 3rd line of the file.
}

Ben


More information about the Help-octave mailing list