필터 지우기
필터 지우기

Max or Min values of multidimensional array with variable number of arrays (3rd dimension)

조회 수: 1 (최근 30일)
Hello, I have a upto 10 arrays of data that I "stack" using the 3rd index i.e. if my arrays are A, B, C....J etc
CombinedArray(:,:,1)=A
CombinedArray(:,:,2)=B
CombinedArray(:,:,3)=C
....
CombinedArray(:,:,3)=J
I then want to find the max and min element wise on this multideimensional array, the problem is I dont have a fixed number for the 3rd dimension, it will always change. Is there a way to do this without using loops?
I thought the following would work but it doesn't
out1=max(CombinedArray,3)
out2=min(CombinedArray,3)
out3=mean(CombinedArray,3)
Thanks
Jason
  댓글 수: 1
Stephen23
Stephen23 2019년 10월 4일
"I thought the following would work but it doesn't"
Did you try reading the min and max help? It expalins how to specify the dimesion.

댓글을 달려면 로그인하십시오.

채택된 답변

Turlough Hughes
Turlough Hughes 2019년 10월 4일
Hi Jason,
The correct syntax is M = max(A,[],dim) and similar for min().
out1=max(CombinedArray,[],3)
out2=min(CombinedArray,[],3)
out3=mean(CombinedArray,3)

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by