bugGNU Octave - Bugs: bug #49696, Matlab eval function accepts a...

 
 

bug #49696: Matlab eval function accepts a column vector string input

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 24 Nov 2016 11:57:39 AM UTC  
 
Category: Octave FunctionSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 25 Nov 2016 05:03:31 PM UTC, comment #4:

Both Octave and Matlab return false for strcmp('abc',strvcat('a','b','c')) so I would assume the issue is not that widespread.

Not sure which other functions to test for. Out of curiosity, I tried this in Matlab

Octave chokes on it:

I'm not sure this really matters though...

Guillaume <gyom>
Fri 25 Nov 2016 04:35:45 PM UTC, comment #3:

Is it generally true that Matlab will treat an Nx1 character array the same as a 1xN character array? Or is that just true of some functions? It would be easy enough to fix just eval for compatibility, but I'm wondering if this is something that should be fixed globally by having string_value treat Nx1 and 1xN arrays the same.

John W. Eaton <jwe>
Project Administrator
Thu 24 Nov 2016 05:14:24 PM UTC, comment #2:

Thanks for your feedback.

For the char array input, I guess this is related to what is described in bug #49536.

For the 1xN vs Nx1 vector, I agree with you. I came across this with an evaluated string that was obtained from reading from a file with fread(fid,'char*').

Guillaume <gyom>
Thu 24 Nov 2016 02:47:32 PM UTC, comment #1:

Confirmed. Octave should definitely either produce an error, or at least a warning that it is using only the first line, if the input is an array.

It also doesn't seem unreasonable to me to require a 1XN vector. That is how most strings would be presented and an Nx1 is likely to be an error. If the user really has such a string they can always transpose it before calling eval.

Rik <rik5>
Project Administrator
Thu 24 Nov 2016 11:57:39 AM UTC, original submission:

In Octave the string input of the eval function has to be a 1xN array while Matlab allows 1xN and Nx1. Matlab throws an error if the input is MxN while Octave will execute the first row.

Matlab:

Octave:

Guillaume <gyom>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #39071:  oct-parse.in.yy added by apx6174 (154KiB - application/octet-stream - Hi, New here. Fixed the bug. Now the user is given a warning in the event that the argument has more than 1 row. )
file #39072:  changeset.txt added by apx6174 (706B - text/plain - Hi, New here. Fixed the bug. Now the user is given a warning in the event that the argument has more than 1 row. )

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by apx6174 (Updated the item)
  • -unavailable- added by apx6174
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 29 Nov 2016 04:16:23 PM UTCrik5SummaryDimensions of the eval function string input=>Matlab eval function accepts a column vector string input
    Mon 28 Nov 2016 10:23:24 PM UTCrik5Dependencies-=>Depends on bugs #49536
    Fri 25 Nov 2016 06:14:18 PM UTCapx6174Attached File-=>Added oct-parse.in.yy, #39071
      Attached File-=>Added changeset.txt, #39072
    Fri 25 Nov 2016 06:04:20 PM UTCapx6174Carbon-Copy-=>Added -unavailable-
    Thu 24 Nov 2016 02:47:32 PM UTCrik5Severity3 - Normal=>2 - Minor
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1