フィルターのクリア

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 Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by