how can i convert the content of a character array to a variable name

조회 수: 4 (최근 30일)
AA
AA 2020년 3월 29일
답변: David Hill 2020년 3월 29일
Hi,
I have a character variable called xx=Hello.
I want to convert that xx variable to a matrix name variable named Hello.
How can I do this?

채택된 답변

David Hill
David Hill 2020년 3월 29일
Generally, you should not do what you are trying to do. One possible solution is to use a struct.
xx='Helo';
myStruct.(xx)=magic(5);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by