Convert cell to matrix

3 views (last 30 days)
Martin Park
Martin Park on 6 Oct 2013
Answered: Jan on 6 Oct 2013
I have the following {'128' '256' '157' '54'} How can I convert it to a numeric matrix for example 128 256 157 54

Accepted Answer

Walter Roberson
Walter Roberson on 6 Oct 2013
str2double()

More Answers (1)

Jan
Jan on 6 Oct 2013
Faster than str2double:
C = {'128' '256' '157' '54'};
S = sprintf('%s*', C{:});
D = sscanf(S, '%g*');

Categories

Find more on Data Type Conversion 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!