Borrar filtros
Borrar filtros

Filtering values from a curve

2 visualizaciones (últimos 30 días)
Shalini
Shalini el 26 de En. de 2013
I have a curve x vs. y and I'm reading into Matlab through excel (xlsread).
I want to filer some values off. I want to filter the y (and corresponding x of course) which are greater than a ceratin value (1500).
How can I achieve this please?
Please help...I shall be grateful

Respuesta aceptada

Wayne King
Wayne King el 26 de En. de 2013
Editada: Wayne King el 26 de En. de 2013
Sounds like you want to remove y-values greater than a certain value.
One way:
idx = find(y>1500);
% now remove the y values and the corresponding x-values
y(idx) = [];
x(idx) = [];
Note that if your x-values were originally evenly-spaced, the above will alter that spacing. Not sure if that is important. There are other things you can do that will preserve the equal spacing. For example, you can set y-values greater than 1500 to NaN (not a number)
y(y>1500) = NaN;

Más respuestas (0)

Categorías

Más información sobre Line Plots 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!

Translated by