Remove unwanted data above the line

7 ビュー (過去 30 日間)
TAN SAK JIE
TAN SAK JIE 2021 年 5 月 27 日
コメント済み: Image Analyst 2021 年 5 月 28 日
As describe above, how can I remove all the unwanted data above the curve magenta line .
  2 件のコメント
KSSV
KSSV 2021 年 5 月 27 日
You have coordinates for both the data? I mean the magenta curve and the blue lines?
TAN SAK JIE
TAN SAK JIE 2021 年 5 月 28 日
Hello Sir.. i have attach the data for the curve magenta line :D

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2021 年 5 月 28 日
Since I don't think you're simply wanting to delete points above the magenta curve, I don't think you can just simply do bTrim(bLine>mLine) = NaN;
I don't think that will handle the case where the magenta curve bends around and goes backwards. So I'd make the magenta curve into a closed polygon with the upper left and upper right corners of the graph (which you can get with xlim and ylim) and then use inpolygon() to set those inside the polygon to null.
But you didn't attach your points and you accepted that answer, so whatever - at least you're happy with what it does. If not, write back, attach your data, and I'll give you my code.
  2 件のコメント
TAN SAK JIE
TAN SAK JIE 2021 年 5 月 28 日
Yes Sir.. there might be a problem when the magenta curve bends around and goes backwards. It cannot remove the data at the curve there
Here I attach my data for the curve
and the link is shown what i facing the problem now
Thanks :)
Image Analyst
Image Analyst 2021 年 5 月 28 日
I don't know what's what. This is what I get:
fileName = 'matlab123.mat';
s = load(fileName)
Topwall = s.Topwall;
for col = 1 : 3
plot(Topwall(:, col), '.');
hold on;
end
legend

サインインしてコメントする。


Allen
Allen 2021 年 5 月 27 日
This can be accomplished using conditional indexing and reassigning values to the blue-line data. The following example assumes that the data for both the blue and magenta datasets are the same size. If they are not then you can resize one or the other set first using interp1. I am also assume that you have your x-data, blue-line data, and magenta-line data assigned to variables x, bLine, and mLine, respectively.
bTrim = bLine; % Initialize new blue line data variable
bTrim(bLine>mLine) = NaN; % Finds indices where bLine is greater than mLine, then assigns NaN to those indices
figure % Original data figure
plot(x,bLine,x,mLine)
figure % Trimmed blue line data figure
plot(x,bTrim,x,mLine)
  1 件のコメント
TAN SAK JIE
TAN SAK JIE 2021 年 5 月 28 日
編集済み: Image Analyst 2021 年 5 月 28 日
Sir, now I am facing another problem for that plot. Could you help me to solve it too?
Here is the link :

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by