octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file


From: Pedro Pena
Subject: [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present
Date: Tue, 16 Jan 2018 22:50:36 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

Follow-up Comment #7, bug #52892 (project octave):

@Dan

I've tried your examples using the same files but our results differ.
That said, specifying eol as "\r" works nicely and also clears things up a
bit. 
I'll have to test it out some more tomorrow.

@Anyone
BTW, I have some experience with C and C++ and I'm interested in looking at
the textscan code.
Is there a recommended development environment for octave or is it pretty much
just use your basic text editor and gdb?
I have the source code and I've seen the documentation produced with doxygen
but no mention of a development environment.

 


>> ver
----------------------------------------------------------------------
GNU Octave Version: 4.2.1
GNU Octave License: GNU General Public License
Operating System: Linux 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39
UTC 2018 x86_64
----------------------------------------------------------------------
Package Name        | Version | Installation directory
--------------------+---------+-----------------------
             image  |   2.6.1 | /home/pedro/octave/image-2.6.1
instrument-control  |   0.2.2 | /home/pedro/octave/instrument-control-0.2.2
                io  |   2.4.2 | /home/pedro/octave/io-2.4.2
               nan  |   3.1.4 | /home/pedro/octave/nan-3.1.4
        statistics  |   1.2.4 | /home/pedro/octave/statistics-1.2.4
>>
[a,b]=textread('cruise_params_with_empty_lines.cfg','%s%s','Delimiter','=','CommentStyle','#');
>> a{1}
ans =
>> b{1}
ans = working_directory
>> a{end}
ans = nan
>> b{end}
ans =
>>
[a,b]=textread('cruise_params_no_empty_lines.cfg','%s%s','Delimiter','=','CommentStyle','#',"endofline","\n");
>> a{1}
ans = working_directory
>> b{1}
ans = .
>> a{end}
ans = beam2earth_bad_down_beam
>> b{end}
ans = nan
>>
[a,b]=textread('cruise_params_no_empty_lines.cfg','%s%s','Delimiter','=','CommentStyle','#',"endofline","\r");
>> a{1}
ans = working_directory
>> b{1}
ans = .
>> a{end}
ans =
>> b{end}
ans =
>> [length(a) length(b)]
ans =

   123   123


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52892>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]