How can I find the Difference between the Min and Max of all matching cells over different matrices?
조회 수: 19 (최근 30일)
이전 댓글 표시
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
2014년 10월 8일
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.
채택된 답변
Mohammad Abouali
2014년 10월 8일
편집: Mohammad Abouali
2014년 10월 8일
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.
댓글 수: 1
추가 답변 (1개)
Aslak Grinsted
2014년 10월 1일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!