Info
此问题已关闭。 请重新打开它进行编辑或回答。
How can I transform two values separted by _ of one colum in two columns?
1 次查看(过去 30 天)
显示 更早的评论
Hallo,
I have one column with two values separated by _ e.g. '78.5888_2.027'.
The aim is to separate these alue sin two columns making pltotting of value one against two possible.
Thank you fro your help,
0 个评论
回答(4 个)
madhan ravi
2019-5-15
s='78.5888_2.027'
str2double(regexp(s,'\d+[\.?]\d*','match'))
6 个评论
madhan ravi
2019-5-15
编辑:madhan ravi
2019-5-15
cell2mat(cellfun(@(x)str2double(regexp(x,...
'\d+[\.]?\d*','match')),...
table2cell(T),'un',0)) % where T is n by 1 table assuming from the picture
Dawn MacIsaac
2019-5-15
You can also use strsplit in combination with str2double(), but you would have to loop through each row in the table.
0 个评论
Star Strider
2019-5-15
This seems to work:
D = load('F.mat');
F = D.F;
for k = 1:size(F,1)
d(k,:) = sscanf(F{k},'%f_%f');
end
The loop is necessary because of the nature of ‘F’.
2 个评论
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!