How can I create a table from variables (DATA, ColumnNames)
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!