MATLAB: Dot indexing is not supported for variables of this type.

dot indexing error

Hello,
I am trying to get the value from an equation by using the solve command, but I keep getting an error that says "Dot indexing is not supported for variables of this type."
I am also getting this error:
Error in sym/subsref (line 900)
R_tilde = builtin('subsref',L_tilde,Idx);
Here is the code:
syms chi
eqn1 = Ka(ii) == (4-Ka(ii))*chi^2 + Ka(ii)*0.58*chi - 01659*Ka(ii);
sol = solve(eqn1, chi);
chi(ii) = double(sol.chi);
I have use the solve command before, and this layout has worked for me then, but now it does not seem to work anymore. Any help would be appreciated.

Best Answer

solve() returns struct when you are solving an equation for multiple variables. If you are solving it for a single variable, it directly returns the value
syms chi
eqn1 = Ka(ii) == (4-Ka(ii))*chi^2 + Ka(ii)*0.58*chi - 01659*Ka(ii);
sol = solve(eqn1, chi);
chi(ii) = double(sol(1)); % sol(1) for the case if equation have multiple solutions