You didn't attach anything, so I'll just assume you can use csvread() or importdata() to get your data into an array m. Then to do the average with loops, not functions like mean() or sum():
Also, like Mike I don't know what you mean by "average of all the columns" - it's ambiguous. It could mean for each row, get the average over all the columns in that row. Or it could mean for each column, get the average of all the values (which span all the rows in the column). I'm going to assume you want one mean for each column and average over all the rows in each column.
[rows, columns] = size(m);
for col = 1 : columns
theSum = 0;
for row = 1 : rows
theSum = theSum + m(row, col);
end
columnMeans(col) = theSum / rows;
end
Best Answer