I have a column with housenumbers. Like:
str = ["54","33", "104A",...]
I want to split it in two columns
Numbers = ["54","33", "104",...]
Letters = ["","", "A",...]

1 comentario

Walter Roberson
Walter Roberson el 10 de Ag. de 2022
https://www.mathworks.com/help/matlab/ref/extract.html

Iniciar sesión para comentar.

 Respuesta aceptada

Stephen23
Stephen23 el 10 de Ag. de 2022
str = ["54","33","104A"];
tkn = regexp(str,'^(\d+)\s*(\w*)$','tokens','once');
tkn = vertcat(tkn{:});
num = tkn(:,1)
num = 3×1 string array
"54" "33" "104"
let = tkn(:,2)
let = 3×1 string array
"" "" "A"

Más respuestas (0)

Categorías

Productos

Versión

R2022a

Preguntada:

el 10 de Ag. de 2022

Respondida:

el 10 de Ag. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by