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

조회 수: 59(최근 30일)
Robert 1 Oct 2014
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.
Thanks in advance for any assistance :)

#### 댓글 수: 1

Image Analyst 8 Oct 2014
Cells? Is the array a cell array or just a regular double numerical array? It's an important distinction regarding how you need to reference the cells or elements.

로그인 to comment.

### 채택된 답변

편집: Mohammad Abouali 8 Oct 2014
so do this
Data(:,:,1)=Month1_Data;
Data(:,:,2)=Month2_Data;
.
.
.
Data(:,:,12)=Month12_Data;
then
Amplitude=max(Data,[],3)-min(Data,[],3);
Amplitude would be what you are asking.

로그인 to comment.

### 추가 답변(1개)

Aslak Grinsted 1 Oct 2014
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.

#### 댓글 수: 1

Robert 8 Oct 2014
Hi, Thanks for your answer. It sort of worked and sort of didn't. This solution gave me another 33x45x12 matrix, where I only want a 33x45 matrix output E.g. so 1:1 shows the max-min of all 12 1:1 cells in the martix...

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.