Delete last row from app.UITable without error

Dear all,
I'm designing a Matlab App and want the user to be able to delete rows from a UITable.
Therefore, I added an extra column at the end of the table with a checkbox. As soon as the user selects this checkbox, the CellEdit-Callback gets called and I can delete this row with:
app.simulationOrientationUITable.Data(event.Indices(1),:) = [];
This works fine, unless it's the last row of the table that I want to delete. Deleting the row still works, if I place a breakpoint just after that line, I don't get any error messages and the row in the table is gone. But just after leaving the Callback function, I get the error message "Row index exceeds table dimensions."
The problem lays in "UITableTableDataModel.m". Line 63
this.controllerInterface.setModelCellData(editValue, row, column, columnIndex);
is the function call that in the end leads to executing my callback function. After the callback function is executed we get back to that file and then in the line
newValue = newData(row,column);
newData is now short by one row, since it got deleted, and selecting the previous row does not work anymore.
For me it sounds like a bug?! Or is there any workaround?
I'm using Matlab R2018b
Best,
Manuel

1 Comment

Hello,
I want to second that question.
We are also running into that problem in 2017b. Deleting the last line of a table in a GUI works completely fine except for the error message 'Index exceeds matrix dimensions.'. This happens now matter how I delete the last line. It would be great to get a workaround or a solution for this problem.

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 13 Feb 2019

Commented:

on 21 Aug 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!