Extract the information of inside and outside of a contourf
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I have a single line of code, quite simple, thanks to which I get (visually) exactly what I need:
h=figure; [pippo1, pippo2]=contourf(AZ,EL,FF, [0, 0]);
where the input arguments have size 301x301. The plot I get is like this:
As you can see, the outside of the contour is not only the big cyan area, but also some small areas in the white (not filled) polygon. I need the coordinates of the outside polygon (the whole cyan region) but I couldn't extract them from either "h" or "pippo2". Please note, I DON'T NEED the coordinates of the single contours, because if I extract XDATA and YDATA they lose the information about "the inside" and the "outside". I need to extract, in some way, a single contour that represents the whole cyan area, and another one that represents the complementary (white) one.
Thanks a lot!
0 Commenti
Risposte (1)
Star Strider
circa 20 ore fa
Tthey are in ‘pippo1’ . In order to extract them, you need to know the level.
The ‘pippo1’ matrtix is arranged as:
pippo1 = [level x-coordinates level x-coordinates; number y-coordinates number y-coordinates]
This prototype code will work tto extract them —
[X,Y,Z] = peaks;
figure
[M,C] = contour(X, Y, Z, 'ShowText',1);
Levels = C.LevelList
for k = 1:numel(Levels)
idx = find(M(1,:) == Levels(k));
ValidV = rem(M(2,idx),1) == 0;
StartIdx{k,:} = idx(ValidV);
VLen{k,:} = M(2,StartIdx{k});
end
.
2 Commenti
Star Strider
circa 19 ore fa
If you only have one level, extract the coordinates as I described, the see what the values of the original matrix are on either side of them. Another option is to use perhaps three closely-spaced levels, and then see where they are in relation to the zero level. You can ignore the other levels in you subsequent analyses, since tthey only serve to identify the relative values around the zero level.
Without your data and relevant code to create the contourf arguments, I can do nothing specific, only descriptive.
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots 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!