How can I create a table from variables (DATA, ColumnNames)
显示 更早的评论
Hi,
I like to create a table containing the variable names and the corresponding data in individual columns.
The data (DATA.m / double) and the corresponding data names (DataNames.m / cell) are located in my matlab workspace, each in a separated variable of the dimension 1x100 (row).
How can I merge a table from these two variables which allocates the data names to the data? I found out that I have to provide the names as a string... e.g.
DataTable = table(DATA,'VariableNames',{'Name1' 'Name2' 'Name3' 'Name4' 'Name5' '...'});
Since there are quite a lot of names in the DataNames-variable I like to avoid this procedure and instead provide only the variable names to a command line... I tried the following command, but it doesn't work:
DataTable = table(Data,'VariableNames',DataNames);
Error: "The VariableNames property must contain one name for each variable in the table."
Is there a quick solution to my problem?
Best regards
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!