turn a vector into a scalar

42 visualizaciones (últimos 30 días)
nicole_matlab
nicole_matlab el 19 de Nov. de 2020
Comentada: Rik el 23 de Nov. de 2020
Hi,
I have a vector
Matlab is telling me that this is 1x1 sym, but I need it to be a scalar.
How can I convert this?
Thanks you
  1 comentario
Ameer Hamza
Ameer Hamza el 19 de Nov. de 2020
g=0.1178542134 is already a scalar. Can you give example of code which gives error?

Iniciar sesión para comentar.

Respuestas (1)

Rik
Rik el 19 de Nov. de 2020
I guess boldly:
g=sym('0.1178542134')
g = 
0.1178542134
g_=double(g) %convert the scalar sym to a scalar double
g_ = 0.1179
  2 comentarios
nicole_matlab
nicole_matlab el 19 de Nov. de 2020
Thank you!
Rik
Rik el 23 de Nov. de 2020
Why did you edit your question?
And if my answer solved your problem, please consider marking it as accepted answer. If not feel free to comment with your remaining issues.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by