splitting range of rows in separate column

조회 수: 2 (최근 30일)
NAVEED ULLAH
NAVEED ULLAH 2022년 10월 8일
댓글: Chris 2022년 10월 8일
i have a large excel data. it has two column. i want to splitt every 17 rows in separate column in the same sheet
how can i do it in matlab?

채택된 답변

Chris
Chris 2022년 10월 8일
편집: Chris 2022년 10월 8일
A = readmatrix('filename.xlsx');
len = size(A,1);
% Make sure array length is divisible by 17.
B = padarray(A,[17-mod(len,17), 0],NaN,'post');
% Reshape each column
wid = size(B,1)/17;
C(:,1:3:3*wid) = reshape(B(:,1),17,wid);
C(:,2:3:3*wid+1) = reshape(B(:,2),17,wid);
% Clear out the zeros in between columns
C(:,3:3:end) = nan;
% Write to file
writematrix(C,'newfile.xlsx')
Is this what you mean?
  댓글 수: 4
NAVEED ULLAH
NAVEED ULLAH 2022년 10월 8일
Thank you so much.
Chris
Chris 2022년 10월 8일
No problem.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by