MATLAB: How to copy a Matrix to a table and how to convert a column to a dropdown menu

categorical format and copy

Q.N 1)
I have a matrix say Z whose size is (4,1). I now want to copy it to a column 4 of my table.
I used the commmads as below but nothing worked.
app.UITable2.data(:,4) = Z ; (It did not work).
app.UITable2.data(:,4) = num2cell(Z ) ; (It did not work).
Q.N 2)
In my table, i want to convert all column 3 cells to a dropdown format which displays Yes and No.
i used the code ,,,,app.UITable.column(3) = categorical({'Yes',{'Yes','No'}); but did not work. Can somebody help me with both the questions.
Thanks.

Best Answer

Does your table have more then 4 rows? Try this
app.UITable2.data(1:4,4) = num2cell(Z);
To display a dropdown menu in the column cell, you can do something like this
app.UITable.ColumnEditable(4) = true;
app.UITable.ColumnFormat(4) = {'Yes','No'};