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일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2021년 3월 3일

답변:

2021년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by