replace "inf " with a value

hi all. i have a 8192*300 matrix. some of its elements are "inf". i want to replace these values with average of cells before and after them. could you give me an advice? thank you very much

3 comentarios

Stephen23
Stephen23 el 14 de Feb. de 2015
Editada: Stephen23 el 14 de Feb. de 2015
How many cells from each side do you want to average: one or more? How do you want to deal with multiple Inf's in a group? What happens with Inf's that are at the edge of the matrix?
per isakson
per isakson el 14 de Feb. de 2015
Editada: per isakson el 14 de Feb. de 2015
maryam
maryam el 14 de Feb. de 2015
Dear Stephen, thank you for your reply. one cell from each side is enough. but i don't have any idea about your next questions! :(

Iniciar sesión para comentar.

Respuestas (1)

Stephen23
Stephen23 el 14 de Feb. de 2015
Editada: Stephen23 el 14 de Feb. de 2015

1 voto

Use TriScatteredInterp or scatteredInterpolant (newer MATLAB versions). You can pass these vectors of your data points excluding the Inf values, and then they will interpolate new points at the grid locations that you specify.

1 comentario

maryam
maryam el 14 de Feb. de 2015
thank you very much, i will test this method. but should i have matlab 2014b? my current version is 2012b.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Feb. de 2015

Comentada:

el 14 de Feb. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by