partion of a rectangle into small rectangles with gaps

3 views (last 30 days)
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 Comments
Geoff Hayes
Geoff Hayes on 19 May 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 on 20 May 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

Sign in to comment.

Accepted Answer

darova
darova on 20 May 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 Comments
Juan Mayor
Juan Mayor on 20 May 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.

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!