How to always return a struct when using solve?
3 次查看(过去 30 天)
显示 更早的评论
Hello,
Using the "solve" command, as long as there is at least 2 equations to solve, MATLAB returns a struct with the fieldnames of each of the variables and the values of those fields equal to the solution for the respective variables. Is there a way to force MATLAB to return a struct instead of a sym even if there is only 1 equation (with the fieldname of the struct equal to the variable name and the value of that field equal to the solution for the 1 variable)? I'm trying to write code to work for a general application, but right now it only works if there are at least 2 equations to solve.
Thank you, Kevin
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!