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

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

[Octave-bug-tracker] [bug #49454] strread commentstyle shell doesn't wor


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #49454] strread commentstyle shell doesn't work as expected
Date: Sat, 17 Dec 2016 20:33:58 -0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0

Update of bug #49454 (project octave):

                Priority:              5 - Normal => 3 - Low                
              Item Group:                    None => Matlab Compatibility   
                  Status:               Confirmed => Need Info              
                 Release:               4.2.0-rc2 => dev                    
                 Summary: strread commentstyle doesn't work as expected =>
strread commentstyle shell doesn't work as expected

    _______________________________________________________

Follow-up Comment #2:

Confirmed, with a couple of workarounds.

The strread function has been deprecated in Matlab, if you use textscan
instead you can get the result that you are looking for, with a slight change


>> textscan ("hello #foo\nworld", "%s", "commentstyle", "#")
ans = 
{
  [1,1] = 
  {
    [1,1] = hello
    [2,1] = world
  }
}


I observe that textscan only recognizes commentstyle when it comes after a
word boundary, that may be a separate bug.

For strread, you can use the undocumented "endofline" property to correctly
get it to do what you want


>> strread ("hello#foo\nworld", "%s", "commentstyle", "shell", "endofline",
"\n")
ans = 
{
  [1,1] = helloworld
}


Except that this is still not quite what you were looking for. In Octave's
strread, it has simply deleted all text between the comment character and the
newline, and the result forms a single word.

Can you or someone test these examples in Matlab to see what changes need to
be made if any?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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