How to convert numbers in cell array into double?

2 ビュー (過去 30 日間)
Abhinav
Abhinav 2014 年 8 月 23 日
コメント済み: Star Strider 2014 年 8 月 23 日
I have a cell array like a = '22 16 55.40', which is dMS values, how to separate these three numbers into three cells into numeric array as follows:-
a = '22 16 55.40' to b = [22 16 55.40]. Any help is greatly appreciated.

採用された回答

Star Strider
Star Strider 2014 年 8 月 23 日
The textscan function works:
a = {'22 16 55.40'};
b = textscan(char(a), '%f %f %f')
produces:
b =
[22.0000e+000] [16.0000e+000] [55.4000e+000]
with b being a (1x3) cell array.
  2 件のコメント
Abhinav
Abhinav 2014 年 8 月 23 日
Thanks a lot!
Star Strider
Star Strider 2014 年 8 月 23 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by