I am trying to create a set of variables based on input.
For example, I have the matrix
angle=[30,45,60]
I do some calculations using each angle and I want to put the results into individual matrices for each angle. I want each matrix to be named partially using the respective input angle. The number of inputs in angle(:) and their values are arbitrary.
For example, the first matrix would be named Qbar30, the second Qbar45, and the third Qbar60. Is there a way to declare variables with an input and a preceding string like 'Qbar'?

 채택된 답변

Amit
Amit 2014년 1월 30일

0 개 추천

If that is what you want, try eval
doc eval
However, you can skip making each variable with a new name and try cell or structure.

댓글 수: 4

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 30일
This is a very bad idea to create several variables. Just use a cell array to store all your matrices
Conor
Conor 2014년 1월 30일
Thanks for the suggestions. I decided to use a 3-D array.
Amit
Amit 2014년 1월 30일
Good choice!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

제품

질문:

2014년 1월 30일

댓글:

2014년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by