Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by