How to get title for excelwrite code depend on data of specific column

조회 수: 3 (최근 30일)
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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 7월 26일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!