The following error occurred converting from sym to double: Unable to convert expression into double array.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gülçin Tekin Özkan
le 22 Sep 2021
Commenté : Gülçin Tekin Özkan
le 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))
Réponse acceptée
Walter Roberson
le 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Number Theory dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!