How to dynamically create symbolic variables?
2 ビュー (過去 30 日間)
古いコメントを表示
Kevin Bachovchin
2014 年 2 月 13 日
コメント済み: Walter Roberson
2018 年 3 月 26 日
Hello,
I'm looking for a way to dynamically create symbolic variables.
For example with the code,
clear all
index = '1';
List = ['A','B','C'];
for i = 1:numel(List)
Temp = [List(i) index]
end
Is there a way I can create symbolic variables with the string stored in Temp?
Thank you, Kevin
0 件のコメント
採用された回答
Azzi Abdelmalek
2014 年 2 月 13 日
編集済み: Azzi Abdelmalek
2014 年 2 月 13 日
Edit
index = {'1'};
List = {'A','B','C'};
Temp=strcat(List,index)
A=sym(Temp)
3 件のコメント
Azzi Abdelmalek
2014 年 2 月 13 日
編集済み: Azzi Abdelmalek
2014 年 2 月 13 日
index = {'1'};
List = {'A','B','C'};
Temp=strcat(List,index)
A=sym(Temp)
その他の回答 (2 件)
Roberto Germanà
2017 年 2 月 15 日
Hello, can I create a matrx in the same way? e.g.
D = [D_11 D12
D_21 D_22]
1 件のコメント
Walter Roberson
2018 年 3 月 26 日
D = sym('D_%d%d',[2,2]);
D(1,2) = sym('D12') ;
I do not know why the one entry is not to follow the pattern, but here it is.
arpit patel
2018 年 3 月 26 日
for i=1:2 for j=1:2 D(i,j)=sym(['D_' num2str(i) num2str(j)]) end end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numbers and Precision についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!