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 reads text file using file ha


From: Pedro Pena
Subject: [Octave-bug-tracker] [bug #52867] textscan reads text file using file handle and produces a garbled cell array
Date: Thu, 11 Jan 2018 21:04:57 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

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

                 Summary: textscan reads text file using file handle and
produces a garbled cell array
                 Project: GNU Octave
            Submitted by: pedrolpena
            Submitted on: Fri 12 Jan 2018 02:04:55 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Pedro Pena
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

textscan under octave 4.2.1 produces a garbled cell array from a text file
input but under Octave 4.02 the output is as one 
would it expect it to be.

A commented text file(configuration file) with variables and assigned values
is read. The delimiter is "=" with "#" read as a comment.


the file 'cruise_params.cfg.tmp'
is first opened and then read with textscan.

The contents are then placed in a cell array.

All works fine under Octave 4.02 but under octave 4.2.1 the cell array is
garbled.

I've included the input file "cruise_params.cfg.tmp"  for testing and I've
included a text file(octaveComparison.txt) with the results from the textscan
for each octave version.


Below is a snippet of the output.

Octave 4.02 (correct)
============

fid=fopen('cruise_params.cfg.tmp','r');
cruiseVars=textscan(fid,'%s%s','Delimiter','=','CommentStyle','#');
cruiseVars
cruiseVars =
{
  [1,1] =
  {
    [1,1] = working_directory
    [2,1] = cruise_id
    [3,1] = cruise_id_prefix
    [4,1] = cruise_id_suffix



Octave 4.21 (incorrect)
===========

fid=fopen('cruise_params.cfg.tmp','r');
cruiseVars=textscan(fid,'%s%s','Delimiter','=','CommentStyle','#');
cruiseVars
cruiseVars =
{
  [1,1] =
  {
    [1,1] = working_directory
    [2,1] = cruise_id
    [3,1] = cruise_id_prefix
    [4,1] = correct_year


I'm not sure if it's a problem with textscan or one of its underlying
functions.

This is part of a processing script that runs fine under octave 4.02
https://github.com/pedrolpena/visbeck_ladcp_processing




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 12 Jan 2018 02:04:55 AM UTC  Name: cruise_params.cfg.tmp  Size:
44KiB   By: pedrolpena
files
<http://savannah.gnu.org/bugs/download.php?file_id=42889>
-------------------------------------------------------
Date: Fri 12 Jan 2018 02:04:55 AM UTC  Name: octaveComparison.txt  Size: 11KiB
  By: pedrolpena
files
<http://savannah.gnu.org/bugs/download.php?file_id=42890>

    _______________________________________________________

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]