Thank you so much for your kind and explicative answer. It works.
The following error occurred converting from sym to double: Unable to convert expression into double array.
2 views (last 30 days)
Show older comments
Gülçin Tekin Özkan
on 22 Sep 2021
Commented: Gülçin Tekin Özkan
on 22 Sep 2021
The following error occurred converting from sym to double:
Unable to convert expression into double array. main purpose is to create a matrix which has unknowns x and y which will be calculated later. So I already created ONM matrix( size 4x1)
After that I tried to assign the elements of ONM matrix to 3rd column of another matrix that is called NM (size 4x1). But the error occured.
How can I fix it?
Thanks for your help
syms x y real
ONM1=[0 x y 0]
ONM=ONM1'
NM(:,3)=(ONM(:,2))
Accepted Answer
Walter Roberson
on 22 Sep 2021
When you created NM, you created it as a numeric array. You cannot "upgrade" a numeric array to be symbolic by assigning symbolic elements in the middle of it.
Before doing that last assignment, do
NM = sym(NM);
or arrange for NM to be constructed as sym when it is created.
0 Comments
More Answers (0)
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!