Adding a string in front of every variable in a table

5 次查看(过去 30 天)
I was looking to make a script that added a string in front of every variable in my table.
For example, I want to add "Table_" in front of every variable in the table I've attached to this post.

采纳的回答

Voss
Voss 2022-9-20
% read the table
t = readtable('Ztable.xlsx','VariableNamingRule','preserve');
% modify the variable names
t.Properties.VariableNames = strcat('Table_',t.Properties.VariableNames);
% save the table
writetable(t,'Ztable_modified.xlsx')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by