Borrar filtros
Borrar filtros

Finding data in matrice

3 visualizaciones (últimos 30 días)
OcDrive
OcDrive el 27 de Mzo. de 2023
Comentada: OcDrive el 28 de Mzo. de 2023
Hello
I got a 6x6x365 matrix. 365 refers to days in the year 6x6 are individual values.
I am trying to find a way of writing a loop that would:
  • identify changes in the 6x6 values, BUT - the values have to change by (more or equal to) 24 and the change has to occur in the same place in the matrix AND the day after yesterday (for example there is a value of 50 in a third row, third column, the next day it drops to 20 also in a third row, third column)
  • create another 6x6x365 matrix with the results (I was thinking of a binary matrix - 0 everywhere where there's no change and 1 when the change occurs)
I'm slightly out of ideas on how to approach the problem (especially the same column-same row part and creating a Boolean matrix)
I'm also open to any other ideas of how to sort the data
Any help would be very appreciated, thank you

Respuesta aceptada

the cyclist
the cyclist el 27 de Mzo. de 2023
If M is your data,
bigChange = abs(diff(M,1,3)) >= 24;
  5 comentarios
the cyclist
the cyclist el 28 de Mzo. de 2023
You need
[row,col,day]=ind2sub([6,6,364],idx);
instead of
[row,col,day]=ind2sub(size(idx),idx);
OcDrive
OcDrive el 28 de Mzo. de 2023
That works great. Thanks so much!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by