How can I combine two categorical columns of a tall table?
6 ビュー (過去 30 日間)
古いコメントを表示
I have a tall table with two categorical columns -- for example:
tx = tall(table(categorical({'a';'b';'b';'b'}), categorical({'x';'x';'y';'y'})));
and I want to create a new column that combines those columns.
For regular tables, I would write:
tx.Var3 = categorical(string(tx.Var1) + " " + string(tx.Var2))
However, this doesn't work with tall tables, since the string.plus method doesn't support tall arrays.
Is there a good way to create this combined column without gathering all the data?
0 件のコメント
回答 (1 件)
Edric Ellis
2017 年 3 月 29 日
You can use join, like so:
join([string(tx.Var1), string(tx.Var2)])
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!