How to replace spaces with underscores in all variable names of a table?
48 次查看(过去 30 天)
显示 更早的评论
Hi,
I am searching for a solution to replace all ' ' (spaces) with underscores '_' in a range of variable names of a table. As the tables vary and the variable names change likewise, I need to find a more universal solution than changing the header names with
X.Properties.VariableNames = {'..' '...'}
I have tried regexprep and strrep, but couldn't find a way to make it work.
Thank you very much in advance!
Judith
0 个评论
采纳的回答
Walter Roberson
2021-8-3
X.Properties.VariableNames = regexprep(X.Properties.VariableNames, ' ', '_'))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!