MATLAB: How to choose a set of columns from the table. I have to get the means of let’s say columns 1 and 5, columns 2 and 6 etc from 20 columns. Thanks

columnsmatrixmean

Does this look like a correct line of code? x = mean(w(:,[1:4:10 11:4:20]));

Best Answer

Looks correct. Means of columns 1 and 5, for instance, would look like this:
x = mean(w(:,[1 5]))
Best.