Reading multiple values from an n*1 cell array.

1 visualización (últimos 30 días)
Hayden Garmon
Hayden Garmon el 23 de Jun. de 2020
Comentada: Hayden Garmon el 23 de Jun. de 2020
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?

Respuesta aceptada

Stephen23
Stephen23 el 23 de Jun. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by