MATLAB: How i do loop over column

for loop

hi all,
I have a matrix with the dim of 978 * 744 which I want to loop over a number of a column with time step equal to 168 (hr/week) to have the final matrices of each week separately with the same number of rows 978
could anyone help me with, please?
thank you in advance.

Best Answer

If you want to do time-based calculation with your data, for example, weekly average or something I'd highly recommend using timetables (version 16b and above). Even for versions a bit older than that, use tables with datevec and then varfun.
Take a look at the examples on this page: https://www.mathworks.com/help/matlab/timetables.html