partion of a rectangle into small rectangles with gaps

3 vues (au cours des 30 derniers jours)
Juan Mayor
Juan Mayor le 19 Mai 2020
Commenté : darova le 20 Mai 2020
Hello Everybody, I would like to wite a code that can divide a rectangle into a certain number of small rectangles( fixed number) together with gaps in between. The dimensions of the small rectangles should be between 0,6 and 9 and the same for the gaps.
  2 commentaires
Geoff Hayes
Geoff Hayes le 19 Mai 2020
Juan - do all of the "small" rectangles have the same dimension? How many rows and/or columns of the smaller rectangles would there be? Can you provide an illustration of what you are looking for?
Juan Mayor
Juan Mayor le 20 Mai 2020
Yes all the small rectangles should have the same dimensions. The number of total small squares will be an input so it will variable each time. I attached here a picture for an example

Connectez-vous pour commenter.

Réponse acceptée

darova
darova le 20 Mai 2020
Try imdilate and meshgrid
A = zeros(100);
[X,Y] = meshgrid(10:20:100);
A(X(:),Y(:)) = 1;
A1 = imdilate(A,ones(10));
imshow(A1)
  2 commentaires
Juan Mayor
Juan Mayor le 20 Mai 2020
Hi Darova,
Thanks for your answer. At the end I will need as a result a lot of configurations because if i give the dimensions of the big rectangles and the number of small squares with a condition that their width and length should be between two values so at the end I will get a number of different configurations.
darova
darova le 20 Mai 2020
How can i help

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by