Split multiple cells into columns.

조회 수: 13 (최근 30일)
Fiona
Fiona 2016년 2월 22일
댓글: Fiona 2016년 3월 6일
Hello,
I currently have a variable that has 46000 rows and 1 column.
Each cell looks something like this:
'0 0 0 0 0 821 69 34 15 0000'
I would like to have each of these numbers (as separated by either 1 or 2 spaces) to be in different columns.
The output would therefore be 46000 rows and 10 columns.
I am not sure how to do this and any help would be appreciated!

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 22일
temp = regexp(YourCell(:), '\s+', 'split');
temp = horzcat(temp{:});
result = str2double(temp);
  댓글 수: 1
Fiona
Fiona 2016년 3월 6일
Brilliant. Thank you for your help Walter!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Automated Driving Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by