UITable.Ro​wName='num​bered'; does not work since upgrade to v2021

7 views (last 30 days)
Just updated to matlab v2021.
The UITable control does not seem to dispaly the table index. It worked without issues in previous releases.
The RowName propery is set to 'numbered' in the App Designer:
Table:
At runtime, if i insert a breakpoint before the table is being refreshed and manually edit the value for RowName (retype the word numbered) the index shows up.
Table:
Thank you in advance for any suggestions.
  3 Comments
PD
PD on 10 Jun 2021
Edited: PD on 10 Jun 2021
Thank you for the quick reply.
Drawnow is being called every time the table or the other controls on the figure are changed.
In an attempt to diagnose and quick fix the issue i added app.UITable.RowName = 'numbered'; before and after the call to redraw. Nothing changes.
However, if i edit the RowName property at runtime as per inital post, the table will remain indexed until the figure is dismissed.
The code in this project is 3-4 years old. All the tables that require indexing are affected by this issue. I had no problems with the other iterations of Matlab until this release.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 10 Jun 2021
The 'numbered' option still works in R2021a when I test it using the two examples below (which could be added to your app's startup function) and the 'numbered' option also works when I define "RowName" in AppDesigner>Design Mode as numbered (without quotes).
Are you getting an error? If not, what do your row names look like?
Is there another part of your app that interacts with the uitable?
T = array2table(rand(5,4));
uif = uifigure();
uit =uitable(uif, 'data',T,'RowName','numbered')
T = array2table(rand(5,4));
uif = uifigure();
uit =uitable(uif, 'data',T)
uit.RowName = 'numbered'
  2 Comments
PD
PD on 12 Jun 2021
Thank you for taking the time to answer my query.
I ran the code from a backup on a machine with v2020 and the tables are indexed. Same code on v2021 is not indexed. I assume something has changed in with Matlab.
I ran your sample code and the table is indexed in Matlab v2021. Then i created a blank app and fed the sample to a table created with the App Designer. No issues.
Lastly, I added your sample code to my form and changed the data source from T to my array. This also produced a new figure that is indexed. As you suggested, is must be another part of my app that interacts with my table. But there are no other references to my table other than a few lines of code, which make no difference if removed. All listed below:
function startupFcn(app, mainapp)
%...
app.UITable.ColumnName = {'C1','C2','C3','C4','C5','C6','C7'};
app.UITable.ColumnWidth = {50,50,50,60,50,50,50};
app.UITable.RowName = 'numbered'; % added 2021.06.08
%...
end
function results = RefreshData(app)
%...
app.UITable.Data = app.tabValues;
app.UITable.RowName = 'numbered'; % added 2021.06.08
% T = array2table(rand(5,4));
% uif = uifigure();
% uit =uitable(uif, 'data',app.tabValues)
% uit.RowName = 'numbered' %this is working!
%...
drawnow;
end
Adam Danz
Adam Danz on 12 Jun 2021
When I try that in app designer (r2021a) I don't have any problems.
Have you tried setting RowName to numbered within DesignView (and then removing the RowName line from the startup function)(see below)?
If that doesn't work, please attach the app and instruction to produce the table, if needed. You may need to attach the app in a zip file, I forget if mlapp attachments are allowed.

Sign in to comment.

More Answers (1)

PD
PD on 14 Jun 2021
After trying all the combinations that i could think of, I left the all the fields empty in the component browser (exempt auto for ColumnWidth).
Then i noticed that there were two instances of app.UITable.RowName = 'numbered'; (startupFcn+ user function). Leaving just one instance solved the problem.
The issue seems to arise in v2021 when using code from previous versions. Multiple calls to RowName method apper to affect the indices.
Thank you all for your helpful suggestions.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!