MATLAB: How to sub in multiple vectors into a structure

commalistMATLABseparatedstructuressubssymbolicSymbolic Math Toolbox

Hello MATLAB community,
I am currently writing a program that contains a structure full of symbolic equations and I need eto evaluate those equations. I am attemtpting to sub in values for certian symbolic variables that are 91×1 vectors. I do not know how to successfully sub in multiple double-valued vectors into a single equation to replace symbolic variables and get a result vector. This is the code I have currently:
Sol_struct.Ax = double(subs({o2 o5 o6 x5 dx Fs}, {Vector_matrix}))
Where o2, o5, o6, x5, dx, and Fs are all 91×1 column vectors, and Sol_struct.Ax is one out of 18 fields of the Sol_struct matrix. It returns a 91×36 double, instead of the expected 91×1 double.
Thank you for any help!

Best Answer

vars = num2cell([o2; o5; o6; x5; dx; Fs]);
Sol_struct.Ax = double(subs(Sol_struct.Ax, vars, Cell_matrix));
Cell_matrix would have to be a (91*6) x 1 cell array containing the replacement values. Each entry could be non-scalar, but the sizes would have to be consistent.
If you are trying to substitute a scalar for each variable, then
vars = [o2; o5; o6; x5; dx; Fs];
Sol_struct.Ax = double(subs(Sol_struct.Ax, vars, Vector_matrix));
Vector_matrix would be a (91*6) x 1 numeric vector.