MATLAB: Mixed data types in a Table

app designermixed type data

I have an app developed using app Designer.
I have a table with 5 rows and 3 columns. These are usually double type and my numbers show up with 4 digits after the decimal point.
However, on the 5th row all 3 columns I like to be treated as integers. for e.g. Insted of [5.0000 25.0000 100.0000] I would like to display them as just [5 25 100].
my code for this part is like app.UITable.Data(5,:) = FD; where FD is a row vector with values 2 25 100 all integer*8 type.
Thanks in advance for any help.

Best Answer

If you are entering values into table using array, you cannot change the values of the last row from double to int as data type of the elements should be same in the arrays.
As a workaround, you can use cell array to store data into table and then change the datatype of the rows as shown in the following code snippet.
app.UITable.Data = {23.34,1.343,343.2;5.0000, 25.0000, 100.0000};
app.UITable.Data(2,:)=num2cell(int8(cell2mat(app.UITable.Data(2,:))));