input = {'0.17 1.7285 0.001763792 1.000977 56651.41 0.000017652 DHT11, OK, 35.0,';
'0.34 1.6992 0.001733896 1.000977 57629.88 0.000017352 DHT11, OK, 34.0,';
'0.51 1.6602 0.001694037 0.996094 58700.00 0.000017036 DHT11, OK, 34.0,';
'0.68 1.6650 0.001699019 1.000977 58814.96 0.000017002 DHT11, OK, 34.0,';
'0.85 1.7187 0.001753827 0.996094 56695.46 0.000017638 DHT11, OK, 34.0,';
'1.02 1.6943 0.001728914 0.996094 57513.83 0.000017387 DHT11, OK, 34.0,';
'1.19 1.6016 0.001634247 0.996094 60851.21 0.000016434 DHT11, OK, 34.0,'};
v = regexp(input,'\d*(\.\d*)?|\w*\d*','match');
out = cat(1,v{:});
lo=~cellfun(@(x)isletter(x(1)),out);
out(lo) = cellfun(@str2double,out(lo),'un',0);
T = cell2table(out);
1 Comment
Walter Roberson (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/476452-splitting-one-column-into-multiple-columns#comment_735939
Sign in to comment.