MATLAB: Problem using subs in syms with matrix

subssyms

syms a b q;
c=q*a+b;
d=c(1);
e=c(2);
f=c(3);
a=[1 2 3]';
b=[4 5 6]';
q=[1 9 0;
2 3 4;
3 5 4];
c=subs(c)
d=subs(d)
e=subs(e)
f=subs(f)
The variable c will be a 3X1 matrix and I wanna extract the individual elements for further operation. Please Help!
I get the error
??? Error using ==> mupadmex Error in MuPAD command: Index exceeds matrix dimensions.
Error in ==> sym.sym>sym.subsref at 1381 B = mupadmex('symobj::subsref',A.s,inds{:});
Error in ==> Untitled2 at 5 e=c(2);

Best Answer

b = sym('b',[3 1])
a = sym('a',[3 1])
q = sym('q',[3 3])
a1 = [1 2 3]';
b1 = [4 5 6]';
q1 = [1 9 0;
2 3 4;
3 5 4];
d = c(1)
d = subs(d,[a(:);b(:);q(:)],[a1(:);b1(:);q1(:)])