필터 지우기
필터 지우기

Reading multiple values from an n*1 cell array.

조회 수: 1 (최근 30일)
Hayden Garmon
Hayden Garmon 2020년 6월 23일
댓글: Hayden Garmon 2020년 6월 23일
I am trying to convert an n*1 cell array into an n*5 matrix of doubles
{'3.748 2.858136 21.447754 13.853117 -9.113155'}
{'3.749 2.869758 21.443939 13.816126 -9.117885'}
Does anyone know how to do this?

채택된 답변

Stephen23
Stephen23 2020년 6월 23일
The most efficient way:
>> C = {'3.7482.85813621.44775413.853117-9.113155'; '3.7492.86975821.44393913.816126-9.117885'};
>> M = sscanf(sprintf(' %s',C{:}),'%f',[5,Inf]).'
M =
3.74820 0.85814 0.44775 0.85312 -9.11316
3.74920 0.86976 0.44394 0.81613 -9.11788

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by