splitting 2 rows of excel using matlab

조회 수: 2 (최근 30일)
Sourav Datta
Sourav Datta 2021년 6월 12일
답변: KSSV 2021년 6월 15일
I have 121 rows with data in excel - data for 120 subjects
The first row is the heading coloumn
I want that if Matlab can split each of the 2 rows - heading row and one other row - to be spilit into new excel sheet
So I want Matlab to split the data into 120 excel files with the heading row constant in them combined with another row
Can anyone help ??
  댓글 수: 2
dpb
dpb 2021년 6월 12일
That's not clear to me what you want, but MATLAB can write whatever you want however you want it; you just have to have an algorithm by which to generate the file names and pick which data you want for each...
Sourav Datta
Sourav Datta 2021년 6월 15일
편집: Sourav Datta 2021년 6월 15일
in simple words
picking up any 2 rows from a series of rows in an excel file and then create another separate excel file keeping only the 2 rows
So if there are 120 rows and I want to split it into multiple excels by keeping the 1st row (which will be constant in all the excel sheets) and any other 1 row
How do I do it

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2021년 6월 15일
T = readtable(myfile) ; % excel file with extension
n = height(T) ;
for i = 1:n
fname = strcat('row',num2str(i),'.xlsx') ;
writetable(T(i,:),fname)
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