Converting cell array to double?

12 visualizzazioni (ultimi 30 giorni)
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 ]

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 11 Ago 2016
Modificato: Azzi Abdelmalek il 11 Ago 2016
A = { 'B 1'; 'B 12'; 'B123' }
B=str2double(regexp(A,'\d+','match','once'))

Più risposte (0)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by