필터 지우기
필터 지우기

How to change the name of the display variable based on input?

조회 수: 2 (최근 30일)
Srikar V.S
Srikar V.S 2023년 11월 30일
댓글: Stephen23 2023년 12월 1일
I am writing a simple matlab code on multilying matrices, one of the matrices in it has elements which are a function of a parameter "theta". I want the name of the matrix (or the variable) to include that value of theta which is used to calculate those elements.
For example, in the display, i want it to show me Q_45 without me having to go and change the name manually. It should recognise that theta is 45 and hence the variable name changes to Q_45.
Please help me with this simple problem.
theta = 45;
Q_theta = [sind(theta) cosd(theta); cosd(theta) sind(theta)]
Q_theta = 2×2
0.7071 0.7071 0.7071 0.7071
  댓글 수: 5
Srikar V.S
Srikar V.S 2023년 11월 30일
Thank you for the suggestions!
Stephen23
Stephen23 2023년 12월 1일
@Shreeya: why did you delete your answer?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by