The following error occurred converting from sym to double: DOUBLE cannot convert the input expression into a double array.
2 views (last 30 days)
Show older comments
sanjay chaudhari
on 25 Mar 2019
Commented: Star Strider
on 27 Mar 2019
syms a b c d e f g h
I am trying to write a code for linprog, so i defined this constant variables
% Lower bounds
lb =(zeros(6,1));
lb(1,2,5,6) = [e,g,a,c];
Then I got the following error from matlab:
The following error occurred converting from sym to double:
DOUBLE cannot convert the input expression into a double array.
please help.
0 Comments
Accepted Answer
Star Strider
on 25 Mar 2019
To define a vector of subscripts to ‘lb’, use square brackets, just as you woukld with any other array:
syms a b c d e f g h
lb([1,2,5,6]) = [e,g,a,c];
producing:
lb =
[ e, g, 0, 0, a, c]
2 Comments
Star Strider
on 27 Mar 2019
My pleasure.
If my Answer helped you solve your problem, please Accept it!
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!