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

1 次查看(过去 30 天)
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.

采纳的回答

Ameer Hamza
Ameer Hamza 2020-6-7
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'};
  14 个评论
Rupesh Uprety
Rupesh Uprety 2020-6-12
"Unable to perform assignment because the indices on the left side are not compatible with the size of the right side." error of this kind appears if i use the above command.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Performance and Memory 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by