MATLAB: Jacobian of equation with left and right hand sides

equationjacobianleft-handright hand

I have a program where the user inputs an equation in the form of a string:
'2*a + 3*b = 5*c' % (just an example, it can be any linear equation)
in sequence I list the variables and take the Jacobian:
allvars = symvar(input);
J = jacobian(input, allvars);
However, because of the "=" in the equation my output is:
J = [ 2 = 0, 3 = 0, 0 = 5]
and instead I *need*** it to be:
J = [ 2, 3, -5]
How can I solve this? Having the user input '2*a + 3*b – 5*c' is not an option.
I tried looking for a rhs/lhs (right/left hand side) function but there aren't any, the @children function is available only in R2012a and greater.

Best Answer

Oh, I didn't realize I hadn't given this thread closure.
I went with Matt Kindig's approach of making the symbolic equation completely left sided, this is a minimum example:
sumblocks = {'y = x1 + x2'}
sides = regexp(sumblocks, '=', 'split');
for i=1:size(sides,1)
sumblocks{i} = sprintf('%s - (%s)', sides{i}{1}, sides{i}{2});
end
The output given in "sumblocks" will be a left-sided equation.