jeudi 8 septembre 2016

How can i create random rectangles (automatically)?

I want to create many rectangles. This should be done automatically. How can i do this without typing thousands of values in my code? Is there an solution?

  • In my code i wrote every single coordinate point (4 points of each rectangle) manually in my vector "V".
  • Also how to connect them. "F"
  • And the value of each rectangle. "C"

Thank you for your input/help. I really appreciate it.

clc
  clear all
  figure;
  V = [0,0;1,0;1,1;0,1;5,5;10,5;10,10;5,10;2,2;4,2;4,4;2,4];
  F = [1,2,3,4;5,6,7,8;9,10,11,12];%Dieser Vektor sagt mir in welcher Reihenfolge die Punkte
  C = [50;24;99]; 
  patch('Faces',F,'Vertices',V,'FaceVertexCData',C,'FaceColor','flat','EdgeColor','none') %Befehl fürs "zeichnen"
  colormap(parula)
  colorbar




Aucun commentaire:

Enregistrer un commentaire