How to change variable name from known string?

5 visualizzazioni (ultimi 30 giorni)
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".

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 1 Lug 2015
assignin('base',Old_var,'New_var')
  1 Commento
Ivan Shorokhov
Ivan Shorokhov il 1 Lug 2015
Thank you, but another way around.
assignin('base','New_var', Old_var )

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by