Symbolic Substitution Using a Struct
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I have a Nx1 matrix of symbolic variables called XReplace. In a symbolic expression called MyExpression, I would like to replace XReplace with the symbolic values in a struct called MyStruct, which has N fields each of which contain a symbolic expression I wish to substitute in. Using NewExpression = subs(MyExpression,XReplace,MyStruct) doesn't work since XReplace is a matrix while MyStruct is a struct. Is there anyway I can do this substitution without using a for loop to iterate through each field of the struct?
Thank you,
Kevin
0 件のコメント
採用された回答
Walter Roberson
2013 年 5 月 28 日
subs(MyExpression, fieldnames(MyStruct), struct2cell(MyStruct))
0 件のコメント
その他の回答 (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!