How can I convert the cell array A into the column vector B? (Deleting the letter B and leading white spaces)
A = { 'B 1'; 'B 12'; 'B123' }
B = [ 1; 12; 123 ]

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 11 Aug. 2016
Bearbeitet: Azzi Abdelmalek am 11 Aug. 2016

1 Stimme

A = { 'B 1'; 'B 12'; 'B123' }
B=str2double(regexp(A,'\d+','match','once'))

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by