Convert string array to numerical vector

170 次查看(过去 30 天)
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?

采纳的回答

Cris LaPierre
Cris LaPierre 2021-3-3
A = ["01";"04";"12"];
B = str2double(A)
B = 3×1
1 4 12

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by