필터 지우기
필터 지우기

finding index of minimum or maximum in tall array

조회 수: 1 (최근 30일)
lalikesbrains
lalikesbrains 2019년 9월 17일
댓글: lalikesbrains 2019년 9월 20일
I'm tryin to find the index of the minimum and maximum of each row in a tall mxn array because I need to determine the number of elements between the max and min for each row. Does anyone have any ideas for how I could do this?
Here's what I've got.
% A is a 100 x 48 tall array
% minA is what I'm using to contain the minimum of each row and the index of the minimum
% maxA contains the maximum of each row and the index of the maximum
minA(:,1) = min(A(:,5:20),[],2); % I only want the minimum value between the 5th and 20th elements
min(:,2) = % index of minA(:,1) for each row + 4 because I'm only searching from the 5th element onwards
% the maximum needs to be the maximum between the minimum element and the 40th element. To do this I need the index of the minimum element.
maxA(:,1) = max(min(:,2):40,[],2);
maxA(:,2) = %index of maxA(:,1) for each row + index of minA bevause I'm only searching from minA onwards.
width(:) = maxA(:,2)-minA(:,2); % width is the number of elements between the min and max for each row
%%
% if this was a regular array and not a tall array, the functions min and max would also return an index,
% but since it's tall, I can't get an index from the function. I've tried find:
find(A(:,(5:20)) == minA(:,1)) % This does not work.
help!
  댓글 수: 2
Jalaj Gambhir
Jalaj Gambhir 2019년 9월 20일
Is it required to store data in tall array format?
lalikesbrains
lalikesbrains 2019년 9월 20일

The data is too big for memory which is why I've been trying to use tall arrays. Is there any other technique that would work?

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

답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by