I have the following {'128' '256' '157' '54'} How can I convert it to a numeric matrix for example 128 256 157 54

更多回答(1 个)

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

类别

帮助中心File Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by