Removing the suffix from a variable name
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have many variables all called something like A_YYY where YYY can be any combination of characters and numbers of different length. How do I automatically rename all of the variables as simply A to analyze in a loop?
1 commentaire
Stephen23
le 19 Juil 2022
"How do I automatically rename all of the variables as simply A to analyze in a loop?"
By not creating them as separate variables:
I doubt that you wrote out all of those variable names by hand, which means you forgot to tell us the most important information: how did you get all of those variables into the workspace? That would be the best palce to fix this bad data design. For example, if they are loaded from a file then you should LOAD them into an output varaible:
S = load(...)
Réponses (1)
Image Analyst
le 19 Juil 2022
It's best to avoid that situation in the first place and make them as elements of an array when they're "created". See the FAQ:
0 commentaires
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!