필터 지우기
필터 지우기

Convert A String Into a MATLAB Variable Name

조회 수: 2 (최근 30일)
Drew
Drew 2011년 7월 7일
I was trying to figure out if a had a string such as a= 'TEMP' and create a second variable which has the name TEMP which I would assign a corresponding value to. The problem is that I want to have 'TEMP' vary in a loop or as part of a function without have to manually assign it.

답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 7월 7일
Don't do it!
What if the variable name is 'size' or 'sum' or something useful and you overwrite a needed builtin function?
  댓글 수: 1
Jan
Jan 2011년 7월 7일
+1. And if it is possible: +1+1+1+1+1

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


Chirag Gupta
Chirag Gupta 2011년 7월 7일
There is a MATLAB function to do this: genvarname
This is useful in certain cases as shown in the examples

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by