%Here is my code – I have three excel files named bec 1, bec 2, bec 3 saved to folder 'loop'. I want to calculate the mean of column 1(named 'potato') ,sheet1 in each file in a loop. I don't really need to store the data in an array but if anyone can help make this code work I would be very appreciative :).
cd('C:\Users\rebec\Desktop\loop')numfiles=3data=[];for fileidx = 1:numfilesfiledata = readmatrix(sprintf('bec %d.xlsx',fileidx));if fileidx == 1data = zeros(size(filedata, 1), numfiles);enddata(:, fileidx) = filedata.potato;end
numfiles =
3
Dot indexing is not supported for variables of this type
Best Answer