splitting range of rows in separate column
3 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!