How to get title for excelwrite code depend on data of specific column
3 views (last 30 days)
Show older comments
hyong suk choo
on 26 Jul 2017
Commented: hyong suk choo
on 26 Jul 2017
I have 1431770 x 4 array data and there are serial of number in 4th column like
156 456 1 1
564 487 2 1
678 174 3 1
734 157 1 2
478 567 2 2
798 175 1 3
456 756 2 3
645 157 3 3
457 156 4 3
241 475 1 4
......
475 478 157 1800
What I want to ask is, how could I write excel data for each number in 4th column. For example,
156 456 1 1
564 487 2 1
678 174 3 1
for 1.xls,
734 157 1 2
478 567 2 2
for 2.xls
... 1800.xls
0 Comments
Accepted Answer
Andrei Bobrov
on 26 Jul 2017
Let data - your data [1431770 x 4].
a = accumarray(data(:,4),1);
out = mat2cell(data,a,size(data,2));
for ii = 1:numel(a)
xlswrite(sprint('%d.xlsx',ii),out{ii});
end
More Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!