Effacer les filtres
Effacer les filtres

finding index of minimum or maximum in tall array

1 vue (au cours des 30 derniers jours)
lalikesbrains
lalikesbrains le 17 Sep 2019
Commenté : lalikesbrains le 20 Sep 2019
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 commentaires
Jalaj Gambhir
Jalaj Gambhir le 20 Sep 2019
Is it required to store data in tall array format?
lalikesbrains
lalikesbrains le 20 Sep 2019

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?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by