Effacer les filtres
Effacer les filtres

How to replace spaces with underscores in all variable names of a table?

63 vues (au cours des 30 derniers jours)
JMSE
JMSE le 3 Août 2021
Commenté : JMSE le 3 Août 2021
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

Réponse acceptée

Walter Roberson
Walter Roberson le 3 Août 2021
X.Properties.VariableNames = regexprep(X.Properties.VariableNames, ' ', '_'))

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by