Clear Filters
Clear Filters

Converting cell array to double?

2 views (last 30 days)
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 ]

Accepted Answer

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

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!