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

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

[Octave-bug-tracker] [bug #35999] strread error on empty string and rela


From: anonymous
Subject: [Octave-bug-tracker] [bug #35999] strread error on empty string and related textread warning on empty file
Date: Sun, 25 Mar 2012 17:21:54 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0

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

                 Summary: strread error on empty string and related textread
warning on empty file
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sun 25 Mar 2012 05:21:53 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.1
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Here is the strread call causes error:
---------------------------------------------
octave:1> [a,b]=strread('', '%s %d')
error: strread: subscript indices must be either positive integers or
logicals
error: called from:
error:   C:\Octave\Octave3.6.1_gcc4.6.2\share\octave\3.6.1\m\io\strread.m at
line 362, column 1
---------------------------------------------

However, if I put any space into the input string, strread works as desired:
----------------------
octave:2> [a,b]=strread(' ', '%s %d')
a = {}(0x1)
b = [](0x1)
----------------------

In parallel, textread would not set the output argument when a file is empty,
and issue a warning and an error.  But textread works as desired if there is
any space in the input file.
-----------------------------------------------
% fubar is an empty file
octave:30> [a,b]=textread('fubar', '%s %d')
warning: textread: empty file
error: element number 1 undefined in return list
% after adding one space into fubar
octave:4> [a,b]=textread('fubar', '%s %d')
a =
{
  [1,1] =
}
b = 0




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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