creating combinations for different data type

i have two inputs which has 2 differnt data types and i wanted to create combinations.
The first Column1 has input1 = 8, Age
The Secind Column 2 has input2 = 20, gender
And i want to create a combinations something like this
8,Age
20,Age
8,gender
20,gender

回答(1 个)

If you're using release R2023a or later use the combinations function.
T = combinations([8, 20], ["Age", "Gender"])
T = 4×2 table
Var1 Var2 ____ ________ 8 "Age" 8 "Gender" 20 "Age" 20 "Gender"

1 个评论

Thanks! But I am using 2019 so i cannot use the combinations function . Is there any other possible way apart from this?

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

版本

R2019a

标签

提问:

PA
2023-7-20

评论:

PA
2023-7-20

Community Treasure Hunt

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

Start Hunting!

Translated by