Matlab - rename a variable with sprintf and save it

Hi everyone, someone can help me please?
i have a variable named Var1 and i want to rename it to:
Var2=sprintf('Name%s%s,LOC,Run)
So i used:
str[var2,'=Var1]; eval(str)
but how can i save the Var2 with the name 'sprintf('Nome%s%s,LOC,Run)' if i don´t know it because depends of the parameters LOC and Run??
I really can´t explain better.
Thanks

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 31일
Var2=sprintf('Name%s%s,LOC,Run)
assignin('base',var2,var1)

댓글 수: 1

lih jo
lih jo 2014년 7월 31일
hi,.
this isn´t working. i need that my new variable have the name: namelocrun (and i need save some information inside), not that var2 have that content.
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2014년 7월 31일

댓글:

2014년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by