Split multiple cells into columns.

1 visualización (últimos 30 días)
Fiona
Fiona el 22 de Feb. de 2016
Comentada: Fiona el 6 de Mzo. de 2016
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!

Respuesta aceptada

Walter Roberson
Walter Roberson el 22 de Feb. de 2016
temp = regexp(YourCell(:), '\s+', 'split');
temp = horzcat(temp{:});
result = str2double(temp);
  1 comentario
Fiona
Fiona el 6 de Mzo. de 2016
Brilliant. Thank you for your help Walter!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by