The following error occurred converting from sym to double: Unable to convert expression into double array.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Gülçin Tekin Özkan
el 22 de Sept. de 2021
Comentada: Gülçin Tekin Özkan
el 22 de Sept. de 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))
Respuesta aceptada
Walter Roberson
el 22 de Sept. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Number Theory en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!