필터 지우기
필터 지우기

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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by