필터 지우기
필터 지우기

How can I find the Difference between the Min and Max of all matching cells over different matrices?

조회 수: 2 (최근 30일)
I already asked this question and thought i was satisfied wth the answer, but turns out i'm not.
Basically I have 12 matrices each for a month of the year (33x45). For each cell I want to know the difference between the max and min values recorded for the entire year.
I then want an output that is another matrix with the resulting differences in the appropriate cells.
The Answer I got was:
I would put the 12 matrices in a 33x45x12 matrix.
Then you can simply call
max(x,3)-min(x,3)
the '3' refers to take the maximum along the 3rd dimension of x.
This sort of works, problem is that the result is another 33x45x12 matrix, where as it should just be a 33x45 matrix
Can I alter the "max(x,3)-min(x,3)" code to do this?
Any further help would be greatly appriciated - Matlab newbie :)

답변 (1개)

the cyclist
the cyclist 2014년 10월 8일
I think you actually need the syntax
max(x,[],3) - min(x,[],3)
to work along the 3rd dimension.
The syntax you are using will simply take the max of x and the number 3, element-by-element.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by