bugGNU Octave - Bugs: bug #59116, Return value for the String...

 
 

bug #59116: Return value for the String property of uicontrol

Submitter:  Guillaume <gyom>
Submitted:  Tue 15 Sep 2020 06:51:31 PM UTC
   
 
Category:  Plotting Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 16 Sep 2020 03:25:25 PM UTC, comment #1: 

Marking as confirmed, and changing the severity to Minor.

The first two instances, where Octave returns a string but Matlab returns a char matrix, are the ones to focus on.

The code to start looking through is in graphics.in.h and the class definition for string_array_property.  The class provides an overload for the string_value() function that creates the pipe-delimited list.


  std::string string_value (void) const
  {
    std::string s;

    for (octave_idx_type i = 0; i < str.numel (); i++)
      {
        s += str[i];
        if (i != str.numel () - 1)
          s += separator;
      }

    return s;
  }


There would probably need to be a new conversion function with an output of char matrix rather than std::string.  This conversion function would essentially just call Fchar() on the list of strings.  And then there would be changing the get function for "string" so that it returned a char matrix so it would pick up the new overload.

Rik <rik5>
Group administrator
Tue 15 Sep 2020 06:51:31 PM UTC, original submission:  

There is a small difference between Matlab and Octave regarding the return value of the String property of a uicontrol widget:


in = { 'a|b|c', ['a';'b';'c'], {'a','b','c'}, ["a","b","c"]};
for i=1:numel(in)
  U = uicontrol ('Style', 'listbox', 'String', in{i});
  get (U, 'String')
end


Matlab returns:


ans =
  3x1 char array
    'a'
    'b'
    'c'
ans =
  3x1 char array
    'a'
    'b'
    'c'
ans =
  3x1 cell array
    {'a'}
    {'b'}
    {'c'}
ans =
  3x1 cell array
    {'a'}
    {'b'}
    {'c'}


Octave returns 'a|b|c' for the first two and does not yet understand string vectors. Compatibility would be achieved by returning char arrays instead of pipe-separated char vectors.

Guillaume <gyom>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by gyom (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
    2020-09-16 rik5 Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code