Convert string array to numerical vector
176 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John Taylor
el 3 de Mzo. de 2021
Respondida: Cris LaPierre
el 3 de Mzo. de 2021
I have numbers as string array A that I'd like to convert to numerical vector B:
A = ["01";"04";"12"];
B = [1; 4; 12];
I've tried with str2num but it seems to proceed only with string scalars rather than vectors.
Any tips without loop?
0 comentarios
Respuesta aceptada
Cris LaPierre
el 3 de Mzo. de 2021
Use str2double
A = ["01";"04";"12"];
B = str2double(A)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion 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!