Reorder rows of UITable in app designer

Guys I need help, if possibile, about what I'm asking in title.
I have an UITable in app designer which contains 5 rows (and it just has 2 columns). What I need to do is change the order of rows if necessary. For example, I'd need to exchange row 1 with row 4, so that each one take the place of the other row. All this when my app is running. I mean, I launch the app created with app designer and which displays the table I mentioned and while it's running I change the rows as said before (if necessary).
I have looked for infos surfing on web, but I haven't found any infos about this.
Thanks.

 Accepted Answer

Pratyush
Pratyush on 3 Jul 2023
Edited: Pratyush on 4 Jul 2023
Hi Massimo. It is my understanding that you have created a UITable in MATLAB App Designer and you would like to swap a specified pair of rows dynamically while the app is running. Here is how you can achieve it.
% store row-1 and row-4 data in variables
row_1 = app.UITable.Data(1,:);
row_4 = app.UITable.Data(4,:);
% swap the rows 1 and 4
app.UITable.Data(1,:) = row_4;
app.UITable.Data(4,:) = row_1;
Here are a few helpful resources related to UITable in MATLAB App Designer.

3 Comments

Thank you for help Pratyush. I'll try to use what you suggested me, although I hoped there were a way to rearrange rows's order so as we can do with column. I mean, on app designer for Uitable there is an option which can be enabled in Design view page, the one called ColumnRearrangeble. When enable and your app is running you can manually change the order of columns with a simple drag and drop. I can't find anything about rows unfortunately, but I'll see what I can do with your suggestion.
Thanks
Hello @Massimo, I would also like to rearrange rows dynamically. Were you able to find a method?
Thanks,
I am having same issue here. Is there any we can do?
Best, Danilo

Sign in to comment.

More Answers (0)

Categories

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

Products

Release

R2022b

Community Treasure Hunt

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

Start Hunting!