Hello, I have an array that is (21,7). I want to get the mean of every three rows from start to finish. For example, my results would output my dependent variable as [0 0 0 1 1 1 2 2 2] while my results/independent variable would be [2 3 2 9 8 7 17 21 16]. I would like to get a result where I get [0 1 2] and with the means [2.333 8 18]. Anyone have a code that would work for all of the columns in my array. I'm novice at MATLAB, so an easy to understand code would really help. If easier or more useful, if I could do the mean of the results for every dependent variable that was the same, that would work too (so I can avoid sorting next time). Thanks!
MATLAB: How to effectively get the mean for every three consecutive outputs
consecutive outputsmean
Related Question
- How to convert 3d monthly data into season
- How to reshape a 2D to 3D matrix without using loops (reshape) and keeping a particular order of the elements// Wrong arragement of elemts after using “reshape”
- Can anyone help me with making a 2D matrix into a 3D matrix
- Finding unique slices of a multidimensional array
- Convert 3-D matrix to a table
Best Answer