필터 지우기
필터 지우기

Change a variable string to a normal variable

조회 수: 41 (최근 30일)
ARTURO GARCIA-PEREZ
ARTURO GARCIA-PEREZ 2024년 6월 26일 23:37
편집: Stephen23 2024년 6월 27일 9:24
I need to change a string variable(x="Eval_E01") to a normal variable for example y=Eval_E01.
Is there a instrucction for this?
Thaks in advance
  댓글 수: 1
Stephen23
Stephen23 2024년 6월 27일 4:34
편집: Stephen23 2024년 6월 27일 9:24
"Is there a instrucction for this?"
Only if you want to force yourself into writing slow, complex, inefficient, obfuscated, buggy code:
"I need to change a string variable(x="Eval_E01") to a normal variable for example y=Eval_E01."
I doubt that you "need" to do that. In almost every case where a beginner writes that they "need" to use dynamic variable names, once they actually describe their usecase we can show them much better ways to achieve their task.
Rather than asking us about your anti-pattern approach, you should explain what your actual problem is:

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

답변 (1개)

Walter Roberson
Walter Roberson 2024년 6월 26일 23:58
Please read http://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval for information about why we strongly recommend against creating variable names dynamically.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by