From: Walter Roberson on
Abhishek wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message
> <dUE1o.20913$Hw.19201(a)newsfe10.iad>...
>> natasha wrote:
>>
>> > I am using solve function to solve equations like
>> > S=solve(eq(1),eq(2),eq(3).......eq(i),TL(1),TL(2)......TL(i+2))
>> > where eq=
>> > [ 'A*p+B*u', >
>> 'y*p+D*q+E*r+F*s', 'G*q+H*r+I*t', >
>> 'J*q+K*s+L*x', 'M*r+N*o+O*t+2*x*P', >
>> '2*x*Q+R*o+S1*s+P*t+U*T+V*z', >
>> 'W*o+N*t+X*T+R*2*x+Y*v', 'd*w+e*v+f*u', >
>> 'g*u+h*p+i*w+j*v', 'k*v+l*o+m*w+n*u', >
>> 'Z*T+2*x*a+b*z+c*o']
>> > > and TL1=<1*25sym>
>> > and eq=
>> > <1*11sym>
>> > i.e both are sym tell me a way to use the solve function as variable
>> > 'i'contains the equations to be solved
>> thanks a lot that works ..
>> one more help ...after solving i do S.TTL1{3} which returns an error
>> given below
> ??? Reference to non-existent field 'TTL1'.
>> i am using S.TTL1{3} because TTTL1 is in the file from which i am
>> reading..
> so i dont know the exact values of the variables.....but i know that my
> output variable is at 3rd position...
>>
>> Teq = num2cell(eq);
>> TTL1 = num2cell(TL1);
>> S = solve(Teq{:},TTL1{:});

If you already had a symbol named TTL1, then it is best that you use a
different variable name to store the temporary cell array.

Also, after the solve() I would use fieldnames(S) to double-check which fields
of S exist (and thus which variables have been solved for.)
From: Abhishek on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i27f05$6i$2(a)canopus.cc.umanitoba.ca>...
> Abhishek wrote:
> > Walter Roberson <roberson(a)hushmail.com> wrote in message
> > <dUE1o.20913$Hw.19201(a)newsfe10.iad>...
> >> natasha wrote:
> >>
> >> > I am using solve function to solve equations like
> >> > S=solve(eq(1),eq(2),eq(3).......eq(i),TL(1),TL(2)......TL(i+2))
> >> > where eq=
> >> > [ 'A*p+B*u', >
> >> 'y*p+D*q+E*r+F*s', 'G*q+H*r+I*t', >
> >> 'J*q+K*s+L*x', 'M*r+N*o+O*t+2*x*P', >
> >> '2*x*Q+R*o+S1*s+P*t+U*T+V*z', >
> >> 'W*o+N*t+X*T+R*2*x+Y*v', 'd*w+e*v+f*u', >
> >> 'g*u+h*p+i*w+j*v', 'k*v+l*o+m*w+n*u', >
> >> 'Z*T+2*x*a+b*z+c*o']
> >> > > and TL1=<1*25sym>
> >> > and eq=
> >> > <1*11sym>
> >> > i.e both are sym tell me a way to use the solve function as variable
> >> > 'i'contains the equations to be solved
> >> thanks a lot that works ..
> >> one more help ...after solving i do S.TTL1{3} which returns an error
> >> given below
> > ??? Reference to non-existent field 'TTL1'.
> >> i am using S.TTL1{3} because TTTL1 is in the file from which i am
> >> reading..
> > so i dont know the exact values of the variables.....but i know that my
> > output variable is at 3rd position...
> >>
> >> Teq = num2cell(eq);
> >> TTL1 = num2cell(TL1);
> >> S = solve(Teq{:},TTL1{:});
>
> If you already had a symbol named TTL1, then it is best that you use a
> different variable name to store the temporary cell array.
>
> Also, after the solve() I would use fieldnames(S) to double-check which fields
> of S exist (and thus which variables have been solved for.)
>thanks a lot it works...