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 Center および File ExchangeConversion 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