I ended up using "eval" function to solve this issue, but I know "eval" is not recommended.
How to convert string to optimization variable?
2 views (last 30 days)
Show older comments
Ephraim Bryski on 12 Jun 2022
Commented: Ephraim Bryski on 18 Jun 2022
I'm doing constrained optimization problems using the "problem based optimization workflow". I'm using a set of equations which have been constructed through string concatenation as the optimizaton variables. I now need to convert these strings to optimvars. It's simple to convert these strings to symbolic variables (just use str2sym), but I can't find anything anologous for optimvars. Any ideas on how to do this?
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!