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

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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

질문:

2019년 2월 13일

댓글:

2019년 8월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by