代码拉取完成,页面将自动刷新
function data = PTstr2num(str, numCols)
%% data = PTstr2num(str, numCols)
% data = PTstr2num(str, numCols)
% modified from:
% https://www.mathworks.com/company/newsletters/articles/tips-for-accelerating-matlab-performance.html
% ----------------------------------------------------------------------------------
% "THE BEER-WARE LICENSE" (Revision 42):
% <brian.white@queensu.ca> wrote this file. As long as you retain this notice you
% can do whatever you want with this stuff. If we meet some day, and you think
% this stuff is worth it, you can buy me a beer in return. -Brian White
% ----------------------------------------------------------------------------------
% faster alternative to str2num
str = char(str);
str(:,end+1) = ' ';
data = sscanf(str','%f');
if nargin>1 && ~isempty(numCols)
data = reshape(data,numCols,[])';
end
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。