turn a vector into a scalar

조회 수: 43 (최근 30일)
nicole_matlab
nicole_matlab 2020년 11월 19일
댓글: Rik 2020년 11월 23일
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
Ameer Hamza
Ameer Hamza 2020년 11월 19일
g=0.1178542134 is already a scalar. Can you give example of code which gives error?

댓글을 달려면 로그인하십시오.

답변 (1개)

Rik
Rik 2020년 11월 19일
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
nicole_matlab
nicole_matlab 2020년 11월 19일
Thank you!
Rik
Rik 2020년 11월 23일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by