필터 지우기
필터 지우기

merge multiple excel file data

조회 수: 10 (최근 30일)
Sara Ejaz
Sara Ejaz 2023년 3월 19일
댓글: Mathieu NOE 2023년 4월 6일
hello..
i store image data into excel file with the size of 786432x1
first file name is 1.csv second file is save as 2.csv upto 500 hundred files each file contain 786432x1 record
know a want to merge all these files in such a way that if first file end an 786432 row then second file record start at 786433 to 1572864
3rd image recored start at 1572865 and upto soo on
all 500 picture are in store in single file with one column

답변 (1개)

Mathieu NOE
Mathieu NOE 2023년 3월 20일
편집: Mathieu NOE 2023년 3월 20일
hello
try this
to make sure to get the files in the right ordre please download first this submission
(dir is not 100% reliable)
P = pwd; % get working directory (or specify it)
S = dir(fullfile(P, '*.csv'));
S = natsortfiles(S); % sort folders / file names into order
% https://fr.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort
data_all = [];
for k = 1:numel(S)
F = fullfile(S(k).folder, S(k).name);
data = readmatrix(F); % or READTABLE or csvimport or whatever.
data_all = [data_all; data(:)];
end

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by