How to remove Y value for given X

4 visualizaciones (últimos 30 días)
Devon Fisher-Chavez
Devon Fisher-Chavez el 12 de Mzo. de 2018
Comentada: David Fletcher el 12 de Mzo. de 2018
I have two columns, X and Y.
The X column is a series of consecutive numbers (1,2,3...). The Y column is my data.
I want to make Y=NaN at certain X values
for example, lets say: x= 1,2,3,4,5 and y= .4,.6,.2,.6,.9
I want to remove the y=.6 that corresponds to x=4 How do I do this?
Thanks!

Respuesta aceptada

David Fletcher
David Fletcher el 12 de Mzo. de 2018
Editada: David Fletcher el 12 de Mzo. de 2018
data=[1 0.4;2,0.6;3,0.2;4,0.6;5 0.9]
index=data(:,1)==4;
data(index,2)=NaN
Something like this?
  6 comentarios
Devon Fisher-Chavez
Devon Fisher-Chavez el 12 de Mzo. de 2018
That works! thank you so much!
David Fletcher
David Fletcher el 12 de Mzo. de 2018
OK no probs

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by