Borrar filtros
Borrar filtros

How to calculate the mean along a matrix dimension, but using a variable range, without using a loop?

1 visualización (últimos 30 días)
I have a matrix A of dimensions (i=80,j=50,k=40,t=12), where the first two dimensions represent longitude and latitude, the third, depth, and the fourth, time. I also have an integer vector v of size 1x12. How can I obtain a matrix of size (80,50,12), by averaging A along its third dimension, but for each t, the range used to compute the mean is given by 1:v(t)?
That is, how can I calculate the mean of A(:, :, 1:v(t),t), along the third dimension, without using a loop? Is it possible to generalize this for matrices of different sizes?

Respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by