How to run an if statement in a cell?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Daniel Tanner
el 5 de Ag. de 2019
Comentada: Stephen23
el 7 de Ag. de 2019
I have a cell containting 125 by 125 elements where each element contains a local 36 by 36 array of data. I am new to this sort of work and I am currently carrying out some data analysis. I want to be able to determine if any of the local data (so data within the 36 by 36 array) are greater than 10% of the local average, but this needs to be done for the whole cell. I can carry this procedure out separately but this is not efficient. Am I correct that an 'if' statement would be able to get the job done? Any help on this would be greatly appreciated.
2 comentarios
Alex Mcaulley
el 5 de Ag. de 2019
What do you want exactly as output? A logical 36x36 array for each cell determining which element is greater than the 10% of the mean of the 36x36 elements?
Respuesta aceptada
Alex Mcaulley
el 5 de Ag. de 2019
Editada: Alex Mcaulley
el 5 de Ag. de 2019
A possible soution:
sol = cellfun(@(in) in > 0.1*mean(in(:)),A,'uni',0); %where A is your cell array
7 comentarios
Stephen23
el 7 de Ag. de 2019
"Do you know of a more simpler way to do this?"
Take a look at blockproc, histcount, histcounts2, etc..
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!