Left of a string

12 visualizaciones (últimos 30 días)
Matthew
Matthew el 14 de Abr. de 2014
Comentada: Matthew el 14 de Abr. de 2014
Hello, I have a column in my table array called key_value.
The array contains a string such as '1234567891234|XYZ|9999'.
How do I code for each of these cells extract the first 13 characters?
I have tried key_value(1:13) but this does not work and simply pulls out the first 13 rows of records.

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Abr. de 2014
cellfun(@(S) S(1:13), key_value, 'Uniform', 0)
  1 comentario
Matthew
Matthew el 14 de Abr. de 2014
Walter, you're a star!
Thanks for your help!

Iniciar sesión para comentar.

Más respuestas (1)

Nitin
Nitin el 14 de Abr. de 2014
If you are accessing a cell array, you should use curly braces. Check out the examples here

Categorías

Más información sobre Logical 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