How to delete certain values below a function/plot?

14 visualizzazioni (ultimi 30 giorni)
I'm trying to delete all values out of a table, which are below values of another table. (The files are attached)
The problem is that my comparison data (SN1520) is in 5° increments, but my measurement data (AWL) is unordered (Only the values of the 2nd and 4th column are important for that). Now I want to clean up the measurement data based on my comparison data, i.e. delete the values in the 4th column of AWL if they are too bad for the value in the 2nd column. Too bad means that they are below the values of SN1520.
So I have tried to plot the SN1520 data and create a function from it:
SN = readtable('SN1520.csv')
figure;
x = SN{:,1};
y = SN{:,2};
plot(x,y);
title('Dependency GPS Elevation');
xlabel('Elevation');
ylabel('GPS');
%Function out of Basis Fitting -> Cubic
gps = 2.03990368077056e-05*x.^3-0.00503162317558603*x.^2+0.466151899356234*x+34.8353383458647;
Now I want to clean up the measurement data using this function so that only good data is available, i.e. values that lie above the function.
I know how to delete the values in each line, but I can't find any code that selects all the data under the function/plot.
  1 Commento
KSSV
KSSV il 8 Lug 2021
If A is matrix and you want to remove all the rows given with indices idx;
A(idx,:) = []

Accedi per commentare.

Risposta accettata

Jonas
Jonas il 8 Lug 2021
do you mean you want to remove every y hat is smaller than gps?
x(y<=gps)=[];
y(y<=gps)=[];
plot(x,y);
  4 Commenti
Markus Vietze
Markus Vietze il 9 Lug 2021
Hey, thank you for this answer. Its working.
But I got two problems with it:
  1. I dont want to delete my rows filled with 999, because they are used for different function.
  2. I have to delete all rows, which include the deleted cells.
May you have a idea for this as well? Would help me a lot!
Thanks!
Peter Perkins
Peter Perkins il 28 Lug 2021
Probably not doing yourself a favor by using readmatrix and all those table2array calls. Read the data as tables, when you need to use thing sin them use dot subscripting, like SN1520.Elevation, SN1520.GPS, AWL.Elevation, and AWL.S_dbHz_. Your code will be much more readable.
If you really want to pull things out of your tables,
Angle=table2array(B(:,3));
is not the best way.
Angle = B.Elevation;
is preferred.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Type Identification in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by