How to change variable name from known string?

5 vues (au cours des 30 derniers jours)
Ivan Shorokhov
Ivan Shorokhov le 1 Juil 2015
Modifié(e) : Stephen23 le 27 Juin 2019
Given: I have variable "Old_var=55" and string "New_var".
Want: How to change name from Old_var to New_var by using code, so I will have new variable "New_var=55".

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 1 Juil 2015
assignin('base',Old_var,'New_var')
  1 commentaire
Ivan Shorokhov
Ivan Shorokhov le 1 Juil 2015
Thank you, but another way around.
assignin('base','New_var', Old_var )

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by