Borrar filtros
Borrar filtros

finding index of minimum or maximum in tall array

1 visualización (últimos 30 días)
lalikesbrains
lalikesbrains el 17 de Sept. de 2019
Comentada: lalikesbrains el 20 de Sept. de 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 comentarios
Jalaj Gambhir
Jalaj Gambhir el 20 de Sept. de 2019
Is it required to store data in tall array format?
lalikesbrains
lalikesbrains el 20 de Sept. de 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?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by