bugGNU Octave - Bugs: bug #41923, genvarname produces variables with...

 
 

bug #41923: genvarname produces variables with leading underscores

Submitter:  cyberdork33 <cyberdork33>
Submitted:  Fri 21 Mar 2014 02:48:57 PM 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:  * 3.8.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 26 Mar 2014 08:33:38 PM UTC, comment #2: 

Eugenio, I applied your change with an edited commit message and a few other small changes.  The most important change is that we don't use TAB characters in our sources.  Please configure your editor to insert spaces instead of literal TAB characters.

John W. Eaton <jwe>
Group administrator
Sun 23 Mar 2014 08:08:45 PM UTC, comment #1: 

I attached a patch to fix this compatibility issue. While working on it, I found out in Matlab's documentation [1] that when dealing with keywords genvarname should output a capitalised version with an x prepended, for instance "for" --> "xFor". I also addressed this.

[1] http://www.mathworks.it/it/help/matlab/ref/genvarname.html

Eugenio Gianniti <eg123>
Fri 21 Mar 2014 02:48:57 PM UTC, original submission:  

Note that I have replicated this on GNU/Linux and OS X 10.8.

octave allows the use of variables names with a leading underscore. data created in octave and saved CAN be loaded in MATLAB, but when working with data, issues can arise where variables with leading underscores would be encountered.

MATLAB's genvarname uses 'x' as a leading character instead of '_'

in octave:

octave:9> genvarname('250_VAR')
ans = _250_VAR


matlab (2013b at least) does not allow leading underscores in variable names.


>> struct._250_Var = 10
 struct._250_Var = 10
        |
Error: The input character is not valid in MATLAB statements or expressions.


cyberdork33 <cyberdork33>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31015:  genvarname.diff added by eg123 (3KiB - application/octet-stream)

 

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 eg123 (Updated the item)
  • -email is unavailable- added by cyberdork33 (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-26 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2014-03-23 eg123 Attached File- Added genvarname.diff, #31015

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code