Copy table's certain data into another table with corresponding variable names
Mostra commenti meno recenti
Let's say I have a table with 10 rows and 10 columns. I'd like to copy 5 cols and 10 rows of the table into another one with their variable names. Is there a way to do that?
Thank you.
Risposta accettata
Più risposte (1)
Just use normal indexing to get your new table:
demotable = cell2table(num2cell(randi(100, 10, 10)), ...
'VariableNames', ...
arrayfun(@(n) sprintf('Name_%d', n), 1:10, 'uni', 0))
newtable = demotable(:, 3:7)
Categorie
Scopri di più su Tables in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!