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 Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Open
Release:  dev Operating 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 Files:
   
   
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
  • -email is unavailable- added by apx6174 (Updated the item)
  • -email is unavailable- added by apx6174
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-29 rik5 SummaryDimensions of the eval function string input => Matlab eval function accepts a column vector string input
    2016-11-28 rik5 Dependencies- => Depends on bugs #49536
    2016-11-25 apx6174 Attached File- => Added oct-parse.in.yy, #39071
        Attached File- => Added changeset.txt, #39072
    2016-11-25 apx6174 Carbon-Copy- => Added -email is unavailable-
    2016-11-24 rik5 Severity3 - Normal => 2 - Minor
        StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.4