Filter löschen
Filter löschen

How can I combine two categorical columns of a tall table?

4 Ansichten (letzte 30 Tage)
James
James am 28 Mär. 2017
Beantwortet: Edric Ellis am 29 Mär. 2017
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?

Antworten (1)

Edric Ellis
Edric Ellis am 29 Mär. 2017
You can use join, like so:
join([string(tx.Var1), string(tx.Var2)])

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by