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

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

[Octave-bug-tracker] [bug #52867] textscan produces an incorrect cell ar


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #52867] textscan produces an incorrect cell array
Date: Fri, 12 Jan 2018 03:29:13 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48

Update of bug #52867 (project octave):

                 Summary: textscan reads text file using file handle and
produces a garbled cell array => textscan produces an incorrect cell array

    _______________________________________________________

Follow-up Comment #2:

Furthermore, it makes no difference whether textscan reads from file or from
text:

>> fid =  fopen ("cruise_params.cfg.txt")
fid =  3
>> txt = fread (fid, Inf, "char=>char")';
>> C = textscan (txt, '%s%s', 'Delimiter', '=', 'CommentStyle', '#');
>> C
C =
{
  [1,1] =
  {
    [1,1] = working_directory
    [2,1] = cruise_id
    [3,1] = cruise_id_prefix
    [4,1] = correct_year
    [5,1] = use_mat_for_nav
:


(note I changed file name extension but that shouldn't matter)

and 
* commentstyle (I tried with removing the comment lines), 
* whitespace setting, 
* endofline (your file contains CRLF, I also tried with just LF) and
* delimiter (changed it into ";")
* empty fields (I added "a" after the "=" in the "cruise_***fix=" lines)
make no difference either.

I cannot confirm that the cell array is "garbled" (the cell array structure
itself looks good), it's just that the file has been read incorrectly, a.o. it
consistently skips the line "cruise_id_suffix=".

-> Title adapted


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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