So I am trying to sort datasheets I'm given in excel into rows of 7 columns. And the datasheet I am given could have any amount of columns for any row. So I was hoping for some help.
This is what I have so far, but it can only handle up to column Y in excel. I want to be able to write something that can handle any amount of columns, just given the input file.
L = length(xlsread('Input'));
N = 7;
X = NaN(1,7);
for i=1:L
xlRange = sprintf('A%d:Y%d',i,i);
A = xlsread('Input',xlRange);
Z = reshape([A(:);nan(mod(-numel(A),N),1)],N,{});
Z = Z.';
X = cat(1,X,Z);
end
xlswrite('Output',X)
0 Comments
Sign in to comment.