如何将字符串转换为数字?number_of_plots = '4'但我想要4个不带''
Tabel_Cell = table2cell(diagramoptions) ;
idx= strfind(Tabel_Cell(:,1), 'number_of_plots');
idx = find(not(cellfun('isempty',idx)));
number_of_plots = Tabel_Cell{idx,2}
%number_of_plots1=double(number_of_plots);
%number_of_plots1=str2num(number_of_plots);
您可以str2num
用来将字符串转换为数字。
如果要将它们转换为浮点数,请使用str2double
比(更安全)更快的方式str2num
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句