I know you can have a UITable with all cell array data, and you can have one with all numeric data, but I want a mix of both in the same UITable, and I also want to allow the user to Sort the column data in an App Design GUI. If I create all cell array data, having my numeric data represented as cell arrays, and I click the Sort feature at the top of the column, it will not properly sort the data numerically. For example, if my numeric column is 4e5, 8e6, 1e7, it will sort as 1e7, 4e5, 8e6, whereas I want it sorted as 4e5, 8e6, 1e7. How do I create a UITable with mixture.
This site shows you can customize the format of a UITable with all numeric: https://www.mathworks.com/help/matlab/ref/format.html#btiwmh5-1-style
But it seems, I cannot have a mixture like this:
app.UITable.ColumnFormat = {'char','shortE','char','shortE','char'};
Maybe a future version of Matlab could allow this.
Otherwise a work-around is to create a function that sorts the numeric columns: UITableDisplayDataChanged(app, event), by converting the cell array data to numeric, then sorting, then converting numeric back to cell to display in the table.
Best Answer