필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by