Borrar filtros
Borrar filtros

How to always return a struct when using solve?

2 visualizaciones (últimos 30 días)
Kevin Bachovchin
Kevin Bachovchin el 12 de Jun. de 2013
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

Respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by