I have a Table in MATLAB. In one colum, lots of texts are seperated in comma. I wish to delimate those in seperate colums.
2 次查看(过去 30 天)
显示 更早的评论
I have a Table in MATLAB. In one colum, lots of texts are seperated in comma. I wish to delimate those in seperate colums.
clc
clear
raw=readtable('Service.xlsx');
r=0;
raw_problem=raw.Expert_Found_Problems;
P=height(raw);
for i=1:1:P
PROBLEMS=raw_problem{i,1};
C = strsplit(PROBLEMS,',')
r=r+1
T(r,:)=table(C)
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242306/image.png)
![44.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242308/44.png)
0 个评论
采纳的回答
Guillaume
2019-10-12
It's not clear what you want as an output since for each row you're going to get a different number of elements after the split. Maybe:
raw.Expert_Found_Problems = cellfun(@(s) strsplit(s, ','), raw.Expert_Found_Problems, 'UniformOutput', false);
which creates a column cell array of cell arrays.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!