using uitable for mixed data
3 ビュー (過去 30 日間)
古いコメントを表示
Stephen Thompson
2017 年 1 月 13 日
コメント済み: Walter Roberson
2017 年 1 月 13 日
I have a table of mixed type: 'word', 1, 5, 9 [multiple rows]
I want to create a table using uitable and get the error: While setting the 'Data' property of 'Table': Data must be a numeric, logical, or cell array
How do I display mixed data?
0 件のコメント
採用された回答
Walter Roberson
2017 年 1 月 13 日
data = {'word', 1, 5, 9; 'another', 7, 13, 21};
uitable('Data', data)
What would not be allowed is
data = {{'word', 1, 5, 9}; {'another', 7, 13, 21}}
That is, it is fine to use a cell array, but each entry inside the cell array must be a character vector or a numeric scalar or a logical (the new string data type is not supported either.). You are probably trying to use a cell array that has cell arrays in it.
2 件のコメント
Walter Roberson
2017 年 1 月 13 日
You need to break those parts into rows. You can use mat2cell for that
T = cellfun(@(M) mat2cell(M, ones(1, size(M,1)), size(M,2)), ThatCell, 'Uniform', 0);
data = [T{1}, T{2}];
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!