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

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

[Octave-bug-tracker] [bug #58008] textscan: literals are managed differe


From: anonymous
Subject: [Octave-bug-tracker] [bug #58008] textscan: literals are managed differently depending on delimiters
Date: Wed, 18 Mar 2020 12:58:18 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

URL:
  <https://savannah.gnu.org/bugs/?58008>

                 Summary: textscan: literals are managed differently depending
on delimiters
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Wed 18 Mar 2020 04:58:16 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: rampin76
        Originator Email: 
             Open/Closed: Open
                 Release: 5.1.0
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Octave version: 5.1.0
Operating system: Windows 10 Enterprise, 64-bit

The textscan function exhibits a strange behaviour when using “literals”.
The behaviour depends on the used delimiter. With a “space” delimiter the
behaviour seems correct, with other types of delimiters (e.g., “;”) not.

Case 1, with space delimiter. I use the following input file

literal_other_1_1 literal_other_1_2
literal_other_2_1 literal_other_2_2
literal_other_3_1 literal_other_3_2

and I scan it with the commands

clear;
fid=fopen('test.txt');
mm=textscan(fid,'literal%s literal%s','Delimiter',' ')
fclose(fid);

getting the expected output

mm =
{
  [1,1] =
  {
    [1,1] = _other_1_1
    [2,1] = _other_2_1
    [3,1] = _other_3_1
  }

  [1,2] =
  {
    [1,1] = _other_1_2
    [2,1] = _other_2_2
    [3,1] = _other_3_2
  }

}

Case 2, with semicolon delimiter. I use the following input file

literal_other_1_1;literal_other_1_2
literal_other_2_1;literal_other_2_2
literal_other_3_1;literal_other_3_2

and I scan it with the commands

clear;
fid=fopen('test.txt');
mm=textscan(fid,'literal%s literal%s','Delimiter',';')
fclose(fid);

getting the unexpected output

mm =
{
  [1,1] =
  {
    [1,1] = _other_1_1
    [2,1] = _other_2_1
    [3,1] = _other_3_1
  }

  [1,2] =
  {
    [1,1] = literal_other_1_2
    [2,1] = literal_other_2_2
    [3,1] = literal_other_3_2
  }

}

I think this is a bug and I didn’t find it in the list, though in the past
other bugs concerning textscan were reported and solved.
The unexpected behaviour occurs also with tab ('\t') and comma (',')
delimiters.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58008>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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