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

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

[Octave-bug-tracker] [bug #58295] add boolean strings support to imporda


From: Fabio
Subject: [Octave-bug-tracker] [bug #58295] add boolean strings support to impordata()
Date: Sat, 2 May 2020 14:24:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0

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

                 Summary: add boolean strings support to impordata()
                 Project: GNU Octave
            Submitted by: efferre79
            Submitted on: Sat 02 May 2020 06:24:54 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

I am using logging files where among numbers there are also boolean values
which are written as a text string "true" or "false". Currently importdata()
treats those values as NA.

I have added a few lines to importdata() to convert the boolean strings into
0/1 integers. Do you like the idea? This of course is an extra functionality
not event present in Matlab, maybe we can add an extra option argument to
enable the possibility. What do you think? 

Here is what happens currently:


octave:1> importdata('test.log',"\t")   
ans =

  scalar structure containing the fields:

    data =

        14    56    NA   656     1    NA
         1    NA     0    21     0     6
         5     5    NA    NA     5     5

    textdata =
    {
      [1,1] = header
      [2,1] = header2
      [3,1] = col1              col3
      [4,1] = row1
      [5,1] = 
      [6,1] = row2
      [7,1] = True
      [8,1] = row3
      [9,1] = False
      [10,1] = 
    }



while this is the result with the proposed patch:


octave:1> importdata('test.log',"\t")
ans =

  scalar structure containing the fields:

    data =

        14    56    NA   656     1    NA
         1     1     0    21     0     6
         5     5     0    NA     5     5

    textdata =
    {
      [1,1] = header
      [2,1] = header2
      [3,1] = col1              col3
      [4,1] = row1
      [5,1] = 
      [6,1] = row2
      [7,1] = row3
      [8,1] = 
    }



The patch is still incomplete because it misses BITS too 

Moreover I have also noticed that missing fields are correctly converted to NA
but they produce empty strings in textdata, they could be removed too because
meaningless.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 02 May 2020 06:24:54 PM UTC  Name: test.log  Size: 85B   By:
efferre79

<http://savannah.gnu.org/bugs/download.php?file_id=48991>
-------------------------------------------------------
Date: Sat 02 May 2020 06:24:54 PM UTC  Name: importdata.m.patch  Size: 709B  
By: efferre79

<http://savannah.gnu.org/bugs/download.php?file_id=48992>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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