bugGNU Octave - Bugs: bug #51848, Variable editor should show text...


bug #51848: Variable editor should show text strings in one cell, not as separate chars each in distinct cells

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Fri 25 Aug 2017 01:51:34 PM UTC  
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  Closed
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.


( Jump to the original submission)

Thu 01 Feb 2018 06:41:12 AM UTC, comment #19:

Just tested, works fine.
Nice that structs can be inspected & edited now - a very valuable addition.


Philip Nienhuis <philipnienhuis>
Project Member
Wed 31 Jan 2018 10:56:02 PM UTC, comment #18:

Sorry, didn't know that the Tip popup was an intended placeholder. I somewhat loosely figured it could maybe be an unintended side effect of your tooltip fix for bug #53001.
My issue stemmed from getting it out of the way to prepare for the screenshot :-)

Anyway thanks for the very quick fix

Philip Nienhuis <philipnienhuis>
Project Member
Wed 31 Jan 2018 10:36:18 PM UTC, comment #17:

Yup, just verified that the latest changeset takes care of this issue. Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 31 Jan 2018 10:31:19 PM UTC, comment #16:

I see what you are saying, but try something which is a full cellstr such as

Now try changing the second element to a number

On my machine, the first cellstr example works as well as the next example.

I think there is an error in how Octave is computing whether something is a string (1xN vector) or a char array (MxN).


The first element of x displays as a string; the second element displays as '[1x5 string]'.

See the attached screenshot.

(file #43146)

Rik <rik5>
Project Administrator
Wed 31 Jan 2018 10:20:18 PM UTC, comment #15:

I think I just fixed this problem in the changeset that added support for structs:


Could you please try again?

Also, I would appreciate it if you would try to avoid saying that things are an "annoyance" (however minor). ESPECIALLY for things like this that are rapidly changing. You might instead guess that "Tip" is just a placeholder until something better can be done.


John W. Eaton <jwe>
Project Administrator
Wed 31 Jan 2018 09:51:03 PM UTC, comment #14:

Reopening. + status to In Progress

Still I see no string text in the V.E., see attached screenshot. I was hoping to see "text" in cell (2, 3) rather than "[1x4 string]".

Double-clicking cell (2, 3) and then pressing the Enter key turns cell (2, 3) into the string "[1x12 string]" (literally).
Double-clicking and entering "text" (w/o quotes) returns the shown cell contents to "[1x4 string]" and in the terminal, 'a{2, 3}' correctly returns ΅text" (all w/o quotes).

In addition, when letting the cursor rest on a cell, a black popup with the text "Tip" appears (just a very minor annoyance).

Mageia-6 Plasma desktop, hg id 13d7fdaad391

(file #43145)

Philip Nienhuis <philipnienhuis>
Project Member
Wed 31 Jan 2018 06:16:16 AM UTC, comment #13:

Works just fine. Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 31 Jan 2018 03:59:09 AM UTC, comment #12:

I pushed the following changeset:


John W. Eaton <jwe>
Project Administrator
Wed 31 Jan 2018 12:14:23 AM UTC, comment #11:

@jwe: That's nice. Editing strings works well for me, and it's cool that they are treated as scalars in cell arrays so I can edit them directly without having to double-click in to the string.

When a string is empty, what does Matlab display? And does it allow editing?

I tried

which prints the error "unable to edit [0x0 'string'] objects".

Incidentally, with 0x0 matrices there is no error and there is nothing to display because the matrix is empty. I think it would at least be preferable to copy that behavior and display nothing rather than an error message.

Rik <rik5>
Project Administrator
Tue 30 Jan 2018 10:23:17 PM UTC, comment #10:

I pushed the following changeset to allow editing of single row character arrays. I think Matlab allows this, but not editing character arrays with more than one row. They may also be edited as elements of cell arrays.


John W. Eaton <jwe>
Project Administrator
Tue 30 Jan 2018 08:07:11 PM UTC, comment #9:

Looking better at file #43113, I see that Matlab's terminal echoes "d(1) = ..." after changing the variable d in its variable editor.

Looks like a bug in Matlab r2018a

Philip Nienhuis <philipnienhuis>
Project Member
Tue 30 Jan 2018 07:15:02 PM UTC, comment #8:

As to the last Q ("BTW") in comment #5:
see attached pic #1, Matlab isn't so smart.

I think that editing char arrays wouldn't be needed. I suppose that type isn't used very often.

As to strings, they behave just like char vectors ("sq_string"), see pic #2.

(file #43112, file #43113)

Philip Nienhuis <philipnienhuis>
Project Member
Mon 29 Jan 2018 11:05:05 PM UTC, comment #7:

Updating comment #6, the display of strings and char arrays is not in doubt. For that there are already examples from Matlab provided in this bug report.

Rik <rik5>
Project Administrator
Mon 29 Jan 2018 11:01:51 PM UTC, comment #6:

Character arrays are going to be difficult. As a first step, I would suggest ignoring them and only editing character row vectors. Per the 80/20 rule, that is going to get you most of what you want without doing too much work.

The model to emulate is probably that of Matlab strings. Hence, if someone could address jwe's questions at the end of comment #5 that would help this bug report move along.

Rik <rik5>
Project Administrator
Mon 29 Jan 2018 10:20:50 PM UTC, comment #5:

RE comment #3: Yes, so that's just the text that you would see in the command window. It's not something that can be edited, correct?

The problem with editing character arrays (AKA string and sq_string objects) is that they don't behave like numeric arrays. With numeric arrays, you can enter arbitrary expressions. As long as they evaluate to something that can be assigned as a scalar element, things should work.

For character arrays, I assume that you would want the text entered verbatim, not evaluated as an expression. Should backslash escape sequences be processed for double-quoted string objects? I assume so, but not for single-quoted string objects. If you entered new text that was longer than the longest existing row, should the object be resized and filled with trailing blanks as necessary instead of throwing an error? What if you shortened the longest row? Would you want the columns trimmed to the length of the new longest row?

BTW, what does Matlab do if you are editing a row vector of numbers (say 1:3) and you type "3:5" as a replacement for the third element? Does it resize and display an array with 5 elements (1:5) or does it fail? I expect failure, but it could be smart and provide this feature.

Also, does Matlab allow editing of its new string objects (created with the string function or double quotes in very recent versions)? If so, how does it behave for display and when entering values in the editor cells?

John W. Eaton <jwe>
Project Administrator
Mon 29 Jan 2018 09:52:26 PM UTC, comment #4:

Adding jwe to the CC list for this bug since he is currently doing a lot of work on the Variable Editor.

Rik <rik5>
Project Administrator
Wed 30 Aug 2017 03:26:14 PM UTC, comment #3:

Attached is a screenshot of how Matlab R2016a displays a char matrix (comment #1) in its variable editor.

(file #41699)

Markus Mützel <mmuetzel>
Project Member
Wed 30 Aug 2017 03:13:31 PM UTC, comment #2:

Matlab r2017b prerelease:

see attached screenshot.
Apparently ML ignores EOL chars in its variable editor. It does preserve them.
It would be cool if Octave could do better.

(file #41698)

Philip Nienhuis <philipnienhuis>
Project Member
Tue 29 Aug 2017 09:18:19 PM UTC, comment #1:

Confirmed. How does Matlab display a char array with multiple rows? Is it sensible with one string per row?

Example code:

Rik <rik5>
Project Administrator
Fri 25 Aug 2017 01:51:34 PM UTC, original submission:

The Variable editor treats strings as char arrays rather than comprehensive strings. Consequently, each character of a text string is shown in a separate cell.

Matlab does this as one would expect, i.e., strings in just one cell.

Philip Nienhuis <philipnienhuis>
Project Member


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

Attach Files:


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 rik5
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by philipnienhuis (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 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-31 rik5 StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2018-01-31 rik5 Attached File- => Added Screenshot_20180131_143021.png, #43146
    2018-01-31 philipnienhuis Attached File- => Added Octave-VE_hg-id_13d7fdaad391.png, #43145
        StatusFixed => In Progress
        Open/ClosedClosed => Open
    2018-01-31 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2018-01-30 jwe StatusConfirmed => Ready For Test
    2018-01-30 philipnienhuis Attached File- => Added ml_extend_arr_in_VE.PNG, #43112
        Attached File- => Added ML_string_in_VE.PNG, #43113
    2018-01-29 rik5 Carbon-Copy- => Added jwe
    2017-08-30 mmuetzel Attached File- => Added bug51848_char_matrix.PNG, #41699
    2017-08-30 philipnienhuis Attached File- => Added ML2017VarEd.png, #41698
    2017-08-29 rik5 StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.3