Effacer les filtres
Effacer les filtres

Fill area inside 4 connected lines in a plot

2 vues (au cours des 30 derniers jours)
Stefan Lang
Stefan Lang le 2 Oct 2020
Commenté : Stefan Lang le 12 Oct 2020
I have a figure, similar to a rectangle. It consists of 4 lines. Top and bottom line is just a connection of the two bottom points, respectively two top points. But left and right line is a matrix with x and y values, resulting from a curve fit between the left top and bottom point, same for the right side. Now i want a matrix to be filled with zeros outside of the rectangles coordinates and with ones inside the rectangle (see picture below).
  1 commentaire
Stefan Lang
Stefan Lang le 5 Oct 2020
Anybody has got an idea? Please

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 5 Oct 2020
Read about padzeros, padarrays.
A = ones(5,4) ;
iwant = zeros(8) ;
iwant(3:7,3:6) = A ;
  3 commentaires
KSSV
KSSV le 5 Oct 2020
[X,Y] = meshgrid(1:10,1:10) ;
[Xi,Yi] = meshgrid(linspace(1.5,9.5,9)) ;
plot(X,Y,'r',X',Y','r')
val = [1:numel(Xi)]' ;
text(Xi(:),Yi(:),num2str(val))
Stefan Lang
Stefan Lang le 12 Oct 2020
I found the poly2mask(). That does exactly what i need. But thanks anyways.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by