bugGNU Octave - Bugs: bug #54417, setstr function missing

 
 

bug #54417: setstr function missing

Submitter:  Arnaud Delorme <arnodelorme>
Submitted:  Wed 01 Aug 2018 07:11:24 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.4.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

  Spam posted by anonymous
Wed 01 Aug 2018 06:24:19 PM UTC, comment #4: 

Philip:  Yeah, I already created a legacy directory (though it wasn't pushed when you commented):

http://hg.savannah.gnu.org/hgweb/octave/rev/a3448e97ccc8

John W. Eaton <jwe>
Group administrator
Wed 01 Aug 2018 06:19:06 PM UTC, comment #3: 

Sure I'm fine with it.
A few years back I pleaded to keep strread.m and that was also granted.
In my POV the distinction is that there's no 1:1 drop-in replacement for strread, while there is for setstr.

In recent years Mathworks has changed their policy in that AFAICS almost all previously deprecated functions now seem to just be "not recommended".

Perhaps it's better to clearly distinguish between 'legacy' Matlab functions and undocumented Matlab functionality. In principle, requests for the former can be granted, for the latter turned down.
Would that work?

Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Aug 2018 05:40:15 PM UTC, comment #2: 

In email, Arnaud wrote:


Based on the Matlab 2018b message, apparently the function will not be removed.

A lot of people just want to run Matlab code on Octave and not spend hours fixing the minute differences. They will try running some Matlab code on Octave. It will generate errors, and they will give up telling others Octave is not compatible with Matlab code.

Why not simply put an alias from setstr() to char(). It is a simple fix and this would allow code to run.


We've kept isstr around for similar reasons, even though it has been documented for more than a decade (maybe two!) that it will be removed from a future version of Matlab.  So sure, we could bring this function back from the dead.  I pushed the following changeset on stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/216321ca4cc4

That said, I want to be clear that I don't think we should go chasing every undocumented Matlab function or feature.  But this case is different: the function does exist in Matlab and is documented, it was just marked at one point for possible future removal.

John W. Eaton <jwe>
Group administrator
Wed 01 Aug 2018 08:09:44 AM UTC, comment #1: 

After typing "help setstr", Matlab r2012a says:
"setstr will be removed in a future release. Use CHAR instead."

Matlab r2018b says:
"setstr is not recommended. Use CHAR instead."

So better fix your Matlab code then :-)


If you really insist in using code in Octave that is deprecated by Matlab, define the following function somewhere in your path, of maybe type it in .octaverc:

function a = setstr (b)
  a = char (b);
endfunction

(Closing with "invalid")

Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Aug 2018 07:11:24 AM UTC, original submission:  

It is synonym to char. Present in Matlab 5.3 to 2018a but absent in Octave.

Arnaud Delorme <arnodelorme>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by arnodelorme (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-01 jwe StatusInvalid / Not an Octave Bug Fixed
    2018-08-01 philipnienhuis StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
        Operating SystemMac OS Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code