フィルターのクリア

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 Center および File ExchangeLoops 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