Finding index values for consecutive values in cell array
Mostrar comentarios más antiguos
Hi all,
I have a 4d cell array: 105 x 3 x3 x 2000 . I would like to find the average number of consecutive values above a threshold value in the 2000 frames throughout 105cells
105 cells look abit like this: (made up numbers)
val(:,:,1) =
1 2 1
6 3 2
1 2 2
to -> val(:,:,2000) =
1 2 1
1 3 2
1 2 1
I would like to find the maximum value in each 2000 cells of my 105 cells ( so 6 for val(:,:,1) and 3 for val(:,:,2000) in this case for cell 1 ). I want set a threshold of a number say 6 ( so only finds val(:,:,1) in this case). Then I want to know how many frames it was above this threshold value for.. so maybe val(:,:,1) to val(:,:,7) which would be 7 frames.
An average of the number of these frames throughout the whole cell array would be ideal.
I am not so good at coding so I need all the help I can get. Thank you in advance!
2 comentarios
Guillaume
el 20 de Mzo. de 2019
I'm confused by your explanations. You say you have 4D array but all your explanation use 3D indexing and seem to ignore the 1st dimension. (So it looks like your first matrix is squeeze(val(1, :, :, 1)) and the 2nd one is squeeze(val(1, :, :, 2000)) maybe.
You also say that you have a cell array, yet your examples use matrices.
It's also unclear whether or not your threshold is an upper or lower threshold (and whether equal values should be kept). I think you want to keep values >= threshold.
What is an average of the number of these frames?
I understood of what the final result should be.
It probably would be best if you gave a complete example of input (using a smaller matrix or cell array) and the desired output for that example, using valid matlab syntax (so there's no ambiguity on the type of the arrays). Either that or attach a mat file to your question
Dylan George
el 20 de Mzo. de 2019
Respuesta aceptada
Más respuestas (1)
Dylan George
el 20 de Mzo. de 2019
0 votos
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!